提交 97ad72a0 编写于 作者: M Matt Bierner

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
上级 0cb6c9f8
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册