in src/completion/completeJSONata.ts [112:145]
function getIncompletePathCompletion({
jsonataNode,
nodePosition,
endPosition,
node,
asl,
}: FunctionCompletionProperties): CompletionList | undefined {
const isErrorNode = jsonataNode.node.type === 'error' && jsonataNode.node.error && jsonataNode.node.error.position
const isParentNodePath = jsonataNode.parent?.type === 'path'
const parentPath = jsonataNode.parent?.steps
if (isErrorNode && isParentNodePath && parentPath) {
const parentPathKey: string =
parentPath
.map((step) => step.value)
.filter((value) => typeof value === 'string' && value)
.join('.') + '.'
const range = Range.create(
Position.create(nodePosition.line, endPosition.character - parentPathKey.length),
endPosition,
)
return {
isIncomplete: true,
items: getVariablesCompletionList({
node,
value: parentPathKey,
asl,
replaceRange: range,
}),
}
}
}