From 1a2a9db425070372ed5796c8a06e8ce5c4b82e0b Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Mon, 20 Dec 2021 20:54:01 +0100 Subject: [PATCH] fix the case when there is nothing in the expr Signed-off-by: Augustin Husson --- web/ui/module/codemirror-promql/src/complete/hybrid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ui/module/codemirror-promql/src/complete/hybrid.ts b/web/ui/module/codemirror-promql/src/complete/hybrid.ts index 8e1c3d4c9..f9a31ba14 100644 --- a/web/ui/module/codemirror-promql/src/complete/hybrid.ts +++ b/web/ui/module/codemirror-promql/src/complete/hybrid.ts @@ -342,7 +342,7 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context } break; case PromQL: - if (!node.firstChild) { + if (node.firstChild !== null && node.firstChild.type.id === 0) { // this situation can happen when there is nothing in the text area and the user is explicitly triggering the autocompletion (with ctrl + space) result.push( { kind: ContextKind.MetricName, metricName: '' },