function getVariablesCompletionList()

in src/completion/completeJSONata.ts [40:68]


function getVariablesCompletionList({
  node,
  value,
  asl,
  replaceRange,
}: {
  node: ASTNode
  value: string
  asl: Asl
  replaceRange: Range
}) {
  const variableCompletions = getVariableCompletions(node, value, asl)
  return (
    variableCompletions?.varList.map((name) => {
      const item = CompletionItem.create(name)
      item.commitCharacters = ['.']

      item.kind = CompletionItemKind.Variable
      const prefix = variableCompletions.completionList.parentPath
      const completeVal = (prefix ? `${VARIABLE_PREFIX}${prefix}.` : '') + name

      item.textEdit = TextEdit.replace(replaceRange, completeVal)
      item.filterText = completeVal
      item.label = name

      return item
    }) || []
  )
}