mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user