fix: filter out empty nodes on the ast (#17517)

pull/17525/head
Alex Boatwright 2020-03-31 17:49:03 -07:00 committed by GitHub
parent 0e4289c595
commit 91d632ea5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -200,9 +200,10 @@ export class LSPServer {
// NOTE: we use the AST intermediate format as a means of reducing
// drift between the parser and the internal representation
const variables = getAllVariables(state, contextID).map(v =>
asAssignment(v)
)
const variables = getAllVariables(state, contextID)
.map(v => asAssignment(v))
.filter(v => !(v.init.type === 'StringLiteral' && !v.init.value))
const file = buildVarsOption(variables)
const parts = uri.split('/')

View File

@ -47,6 +47,14 @@ function shouldShowTooltip(variable: Variable): boolean {
return false
}
if (
variable.arguments.type === 'query' &&
(!(variable.arguments.values as any).results ||
(variable.arguments.values as any).results.length <= 1)
) {
return false
}
return true
}