mirror of
https://github.com/Microsoft/vscode
synced 2024-11-05 18:29:38 +00:00
Dont enable commit characters in case where cursor is at dot preceeded by whitespace
Fixes #59934 Proper fix is upstream https://github.com/Microsoft/TypeScript/issues/27742
This commit is contained in:
parent
0cb6c9f8b1
commit
97ad72a02c
1 changed files with 10 additions and 8 deletions
|
@ -456,14 +456,16 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
|||
document: vscode.TextDocument,
|
||||
position: vscode.Position
|
||||
): boolean {
|
||||
// TODO: Workaround for https://github.com/Microsoft/TypeScript/issues/13456
|
||||
// Only enable dot completions when previous character is an identifier.
|
||||
// Prevents incorrectly completing while typing spread operators.
|
||||
if (position.character > 1) {
|
||||
const preText = document.getText(new vscode.Range(
|
||||
position.line, 0,
|
||||
position.line, position.character));
|
||||
return preText.match(/(^|[a-z_$\(\)\[\]\{\}]|[^.]\.)\s*$/ig) !== null;
|
||||
if (this.client.apiVersion.lt(API.v320)) {
|
||||
// Workaround for https://github.com/Microsoft/TypeScript/issues/27742
|
||||
// Only enable dot completions when previous character not a dot preceeded by whitespace.
|
||||
// Prevents incorrectly completing while typing spread operators.
|
||||
if (position.character > 1) {
|
||||
const preText = document.getText(new vscode.Range(
|
||||
position.line, 0,
|
||||
position.line, position.character));
|
||||
return preText.match(/(\s|^)\.$/ig) === null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue