Send #
as a completion trigger character to TS 3.8.1+
https://github.com/microsoft/TypeScript/issues/36367 added support for `#` as a TS completion trigger
This commit is contained in:
parent
c0c9e0043c
commit
c4b6a6b537
|
@ -23,8 +23,6 @@ import FileConfigurationManager from './fileConfigurationManager';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
const knownTsTriggerCharacters = new Set<string>(['.', '"', '\'', '`', '/', '@', '<']);
|
|
||||||
|
|
||||||
interface DotAccessorContext {
|
interface DotAccessorContext {
|
||||||
readonly range: vscode.Range;
|
readonly range: vscode.Range;
|
||||||
readonly text: string;
|
readonly text: string;
|
||||||
|
@ -461,18 +459,23 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTsTriggerCharacter(context: vscode.CompletionContext): Proto.CompletionsTriggerCharacter | undefined {
|
private getTsTriggerCharacter(context: vscode.CompletionContext): Proto.CompletionsTriggerCharacter | undefined {
|
||||||
// Workaround for https://github.com/Microsoft/TypeScript/issues/27321
|
switch (context.triggerCharacter) {
|
||||||
if (context.triggerCharacter === '@'
|
case '@': // Workaround for https://github.com/Microsoft/TypeScript/issues/27321
|
||||||
&& this.client.apiVersion.gte(API.v310) && this.client.apiVersion.lt(API.v320)
|
return this.client.apiVersion.gte(API.v310) && this.client.apiVersion.lt(API.v320) ? undefined : '@';
|
||||||
) {
|
|
||||||
return undefined;
|
case '#': // Workaround for https://github.com/microsoft/TypeScript/issues/36367
|
||||||
|
return this.client.apiVersion.lt(API.v381) ? undefined : '#' as Proto.CompletionsTriggerCharacter;
|
||||||
|
|
||||||
|
case '.':
|
||||||
|
case '"':
|
||||||
|
case '\'':
|
||||||
|
case '`':
|
||||||
|
case '/':
|
||||||
|
case '<':
|
||||||
|
return context.triggerCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.triggerCharacter && !knownTsTriggerCharacters.has(context.triggerCharacter)) {
|
return undefined;
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return context.triggerCharacter as Proto.CompletionsTriggerCharacter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveCompletionItem(
|
public async resolveCompletionItem(
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default class API {
|
||||||
public static readonly v345 = API.fromSimpleString('3.4.5');
|
public static readonly v345 = API.fromSimpleString('3.4.5');
|
||||||
public static readonly v350 = API.fromSimpleString('3.5.0');
|
public static readonly v350 = API.fromSimpleString('3.5.0');
|
||||||
public static readonly v380 = API.fromSimpleString('3.8.0');
|
public static readonly v380 = API.fromSimpleString('3.8.0');
|
||||||
|
public static readonly v381 = API.fromSimpleString('3.8.1');
|
||||||
|
|
||||||
public static fromVersionString(versionString: string): API {
|
public static fromVersionString(versionString: string): API {
|
||||||
let version = semver.valid(versionString);
|
let version = semver.valid(versionString);
|
||||||
|
|
Loading…
Reference in a new issue