Use parent token (revertable)
This commit is contained in:
@@ -102,12 +102,8 @@ export async function complete(
|
||||
let replaceRange: Range | undefined;
|
||||
if (token?.range) {
|
||||
replaceRange = mapRange(token.range);
|
||||
} else if (!token) {
|
||||
// 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);
|
||||
} else if (!token && parent?.range) {
|
||||
replaceRange = mapRange(parent.range)
|
||||
}
|
||||
|
||||
return values.map(value => {
|
||||
|
||||
Reference in New Issue
Block a user