mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
Make sure we trigger js/ts completions on /
This commit is contained in:
parent
4d3a8ae210
commit
f71c378488
|
@ -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)\(['"][^'"]*$/)) {
|
||||
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 === '<') {
|
||||
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(/\/\*\*+[ ]?@/)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.triggerCharacter === '<') {
|
||||
return this.client.apiVersion.gte(API.v290);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue