fix shouldTrigger check
This commit is contained in:
parent
f574fc35bd
commit
ea84909a86
1 changed files with 11 additions and 13 deletions
|
@ -310,21 +310,19 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP
|
||||||
pre: string,
|
pre: string,
|
||||||
option: any
|
option: any
|
||||||
): boolean {
|
): boolean {
|
||||||
if (triggerCharacter === '.') {
|
if (triggerCharacter && this.client.apiVersion.lt(API.v290)) {
|
||||||
if (pre.match(/[\s\.'"]\.$/)) {
|
if (triggerCharacter === '@') {
|
||||||
|
// trigger in string
|
||||||
|
if (option.synname && /string/i.test(option.synname)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// make sure we are in something that looks like the start of a jsdoc comment
|
||||||
|
if (!pre.match(/^\s*\*[ ]?@/) && !pre.match(/\/\*\*+[ ]?@/)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (triggerCharacter === '<') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else if (triggerCharacter === '@') {
|
|
||||||
// trigger in string
|
|
||||||
if (option.synname && /string/i.test(option.synname)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// make sure we are in something that looks like the start of a jsdoc comment
|
|
||||||
if (!pre.match(/^\s*\*[ ]?@/) && !pre.match(/\/\*\*+[ ]?@/)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else if (triggerCharacter === '<') {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Add table
Reference in a new issue