fix the case when there is nothing in the expr

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
Augustin Husson 2021-12-20 20:54:01 +01:00
parent 87463257a7
commit 1a2a9db425
1 changed files with 1 additions and 1 deletions

View File

@ -342,7 +342,7 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context
} }
break; break;
case PromQL: 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) // 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( result.push(
{ kind: ContextKind.MetricName, metricName: '' }, { kind: ContextKind.MetricName, metricName: '' },