|
|
|
|
@ -400,12 +400,18 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode, pos: num |
|
|
|
|
// so we have or to autocomplete any kind of labelName or to autocomplete only the labelName associated to the metric
|
|
|
|
|
result.push({ kind: ContextKind.LabelName, metricName: getMetricNameInGroupBy(node, state) }); |
|
|
|
|
break; |
|
|
|
|
case LabelMatchers: |
|
|
|
|
case LabelMatchers: { |
|
|
|
|
if (pos >= node.to) { |
|
|
|
|
// Cursor is outside of the label matcher block (e.g. right after `}`),
|
|
|
|
|
// so don't offer label-related completions anymore.
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// In that case we are in the given situation:
|
|
|
|
|
// metric_name{} or {}
|
|
|
|
|
// so we have or to autocomplete any kind of labelName or to autocomplete only the labelName associated to the metric
|
|
|
|
|
result.push({ kind: ContextKind.LabelName, metricName: getMetricNameInVectorSelector(node, state) }); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case LabelName: |
|
|
|
|
if (node.parent?.type.id === GroupingLabels) { |
|
|
|
|
// In this case we are in the given situation:
|
|
|
|
|
|