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

Make sure we trigger js/ts completions on /

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