TS semantic highlighting: check api version
This commit is contained in:
parent
0d9ebc47d3
commit
0fe69bd529
2 changed files with 9 additions and 0 deletions
|
@ -6,8 +6,16 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ITypeScriptServiceClient, ExecConfig, ServerResponse } from '../typescriptService';
|
import { ITypeScriptServiceClient, ExecConfig, ServerResponse } from '../typescriptService';
|
||||||
import * as Proto from '../protocol';
|
import * as Proto from '../protocol';
|
||||||
|
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||||
|
import API from '../utils/api';
|
||||||
|
|
||||||
|
const minTypeScriptVersion = API.v370;
|
||||||
|
|
||||||
export function register(selector: vscode.DocumentSelector, client: ITypeScriptServiceClient) {
|
export function register(selector: vscode.DocumentSelector, client: ITypeScriptServiceClient) {
|
||||||
|
return new VersionDependentRegistration(client, minTypeScriptVersion, () => {
|
||||||
|
const provider = new SemanticTokensProvider(client);
|
||||||
|
return vscode.languages.registerSemanticTokensProvider(selector, provider, provider.getLegend());
|
||||||
|
});
|
||||||
const provider = new SemanticTokensProvider(client);
|
const provider = new SemanticTokensProvider(client);
|
||||||
return vscode.languages.registerSemanticTokensProvider(selector, provider, provider.getLegend());
|
return vscode.languages.registerSemanticTokensProvider(selector, provider, provider.getLegend());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ export default class API {
|
||||||
public static readonly v340 = API.fromSimpleString('3.4.0');
|
public static readonly v340 = API.fromSimpleString('3.4.0');
|
||||||
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 v370 = API.fromSimpleString('3.7.0');
|
||||||
public static readonly v380 = API.fromSimpleString('3.8.0');
|
public static readonly v380 = API.fromSimpleString('3.8.0');
|
||||||
|
|
||||||
public static fromVersionString(versionString: string): API {
|
public static fromVersionString(versionString: string): API {
|
||||||
|
|
Loading…
Reference in a new issue