Skip to content

Commit

Permalink
Dont enable commit characters in case where cursor is at dot preceede…
Browse files Browse the repository at this point in the history
…d by whitespace

Fixes #59934

Proper fix is upstream microsoft/TypeScript#27742
  • Loading branch information
mjbvz committed Oct 31, 2018
1 parent 0cb6c9f commit 97ad72a
Showing 1 changed file with 10 additions and 8 deletions.
Expand Up @@ -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;
Expand Down

0 comments on commit 97ad72a

Please sign in to comment.