提交 f71c3784 编写于 作者: M Matt Bierner

Make sure we trigger js/ts completions on /

上级 4d3a8ae2
...@@ -449,42 +449,44 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider ...@@ -449,42 +449,44 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
line: vscode.TextLine, line: vscode.TextLine,
position: vscode.Position position: vscode.Position
): boolean { ): boolean {
if ((context.triggerCharacter === '"' || context.triggerCharacter === '\'') && !this.client.apiVersion.gte(API.v290)) { if (context.triggerCharacter && !this.client.apiVersion.gte(API.v290)) {
if (!config.quickSuggestionsForPaths) { if ((context.triggerCharacter === '"' || context.triggerCharacter === '\'')) {
return false; if (!config.quickSuggestionsForPaths) {
} return false;
}
// make sure we are in something that looks like the start of an import // make sure we are in something that looks like the start of an import
const pre = line.text.slice(0, position.character); const pre = line.text.slice(0, position.character);
if (!pre.match(/\b(from|import)\s*["']$/) && !pre.match(/\b(import|require)\(['"]$/)) { if (!pre.match(/\b(from|import)\s*["']$/) && !pre.match(/\b(import|require)\(['"]$/)) {
return false; return false;
}
} }
}
if (context.triggerCharacter === '/') { if (context.triggerCharacter === '/') {
if (!config.quickSuggestionsForPaths) { if (!config.quickSuggestionsForPaths) {
return false; return false;
}
// make sure we are in something that looks like an import path
const pre = line.text.slice(0, position.character);
if (!pre.match(/\b(from|import)\s*["'][^'"]*$/) && !pre.match(/\b(import|require)\(['"][^'"]*$/)) {
return false;
}
} }
// make sure we are in something that looks like an import path if (context.triggerCharacter === '@') {
const pre = line.text.slice(0, position.character); // make sure we are in something that looks like the start of a jsdoc comment
if (!pre.match(/\b(from|import)\s*["'][^'"]*$/) && !pre.match(/\b(import|require)\(['"][^'"]*$/)) { const pre = line.text.slice(0, position.character);
return false; if (!pre.match(/^\s*\*[ ]?@/) && !pre.match(/\/\*\*+[ ]?@/)) {
return false;
}
} }
}
if (context.triggerCharacter === '@' && !this.client.apiVersion.gte(API.v290)) { if (context.triggerCharacter === '<') {
// make sure we are in something that looks like the start of a jsdoc comment
const pre = line.text.slice(0, position.character);
if (!pre.match(/^\s*\*[ ]?@/) && !pre.match(/\/\*\*+[ ]?@/)) {
return false; return false;
} }
} }
if (context.triggerCharacter === '<') {
return this.client.apiVersion.gte(API.v290);
}
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册