Revert "Use parent token (revertable)"

This reverts commit d5831b2e89.
This commit is contained in:
Jacob Wallraff
2023-01-24 13:16:19 -08:00
parent 0cf34d914d
commit f3a570d10d
+6 -2
View File
@@ -112,8 +112,12 @@ export async function complete(
let replaceRange: Range | undefined; let replaceRange: Range | undefined;
if (token?.range) { if (token?.range) {
replaceRange = mapRange(token.range); replaceRange = mapRange(token.range);
} else if (!token && parent?.range) { } else if (!token) {
replaceRange = mapRange(parent.range) // Not a valid token, create a range from the current position
const line = newDoc.getText({start: {line: position.line, character: 0}, end: position});
// Get the length of the current word
const val = line.match(/[\w_-]*$/)?.[0].length || 0;
replaceRange = Range.create({line: position.line, character: position.character - val}, position);
} }
return values.map(value => { return values.map(value => {