mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Change API to use constant values
This helps prevent misuse of the API objects and will allow for more declarative apis
This commit is contained in:
@@ -10,6 +10,7 @@ import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { Delayer } from '../utils/async';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import * as languageModeIds from '../utils/languageModeIds';
|
||||
import API from '../utils/api';
|
||||
|
||||
|
||||
interface IDiagnosticRequestor {
|
||||
@@ -41,18 +42,18 @@ class SyncedBuffer {
|
||||
fileContent: this.document.getText(),
|
||||
};
|
||||
|
||||
if (this.client.apiVersion.has203Features()) {
|
||||
if (this.client.apiVersion.gte(API.v203)) {
|
||||
const scriptKind = mode2ScriptKind(this.document.languageId);
|
||||
if (scriptKind) {
|
||||
args.scriptKindName = scriptKind;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.client.apiVersion.has230Features()) {
|
||||
if (this.client.apiVersion.gte(API.v230)) {
|
||||
args.projectRootPath = this.client.getWorkspaceRootForResource(this.document.uri);
|
||||
}
|
||||
|
||||
if (this.client.apiVersion.has240Features()) {
|
||||
if (this.client.apiVersion.gte(API.v240)) {
|
||||
const tsPluginsForDocument = this.client.plugins
|
||||
.filter(x => x.languages.indexOf(this.document.languageId) >= 0);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import * as nls from 'vscode-nls';
|
||||
import { applyCodeAction } from '../utils/codeAction';
|
||||
import { CommandManager, Command } from '../utils/commandManager';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
import API from '../utils/api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -447,7 +448,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
||||
line: vscode.TextLine,
|
||||
position: vscode.Position
|
||||
): boolean {
|
||||
if ((context.triggerCharacter === '"' || context.triggerCharacter === '\'') && !this.client.apiVersion.has290Features()) {
|
||||
if ((context.triggerCharacter === '"' || context.triggerCharacter === '\'') && !this.client.apiVersion.gte(API.v290)) {
|
||||
if (!config.quickSuggestionsForPaths) {
|
||||
return false;
|
||||
}
|
||||
@@ -471,7 +472,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
||||
}
|
||||
}
|
||||
|
||||
if (context.triggerCharacter === '@' && !this.client.apiVersion.has290Features()) {
|
||||
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(/\/\*\*+[ ]?@/)) {
|
||||
@@ -480,7 +481,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
||||
}
|
||||
|
||||
if (context.triggerCharacter === '<') {
|
||||
return this.client.apiVersion.has290Features();
|
||||
return this.client.apiVersion.gte(API.v290);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import API from '../utils/api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -77,7 +78,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has230Features();
|
||||
return api.gte(API.v230);
|
||||
},
|
||||
register() {
|
||||
return vscode.languages.registerCompletionItemProvider(selector,
|
||||
|
||||
@@ -9,6 +9,7 @@ import * as Proto from '../protocol';
|
||||
import * as PConst from '../protocol.const';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import API from '../utils/api';
|
||||
|
||||
const getSymbolKind = (kind: string): vscode.SymbolKind => {
|
||||
switch (kind) {
|
||||
@@ -44,7 +45,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||
};
|
||||
|
||||
try {
|
||||
if (this.client.apiVersion.has206Features()) {
|
||||
if (this.client.apiVersion.gte(API.v206)) {
|
||||
const response = await this.client.execute('navtree', args, token);
|
||||
if (response.body) {
|
||||
// The root represents the file. Ignore this when showing in the UI
|
||||
|
||||
@@ -8,6 +8,7 @@ import { workspace as Workspace, FormattingOptions, TextDocument, CancellationTo
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import * as languageIds from '../utils/languageModeIds';
|
||||
import API from '../utils/api';
|
||||
|
||||
function objsAreEqual<T>(a: T, b: T): boolean {
|
||||
let keys = Object.keys(a);
|
||||
@@ -144,7 +145,7 @@ export default class FileConfigurationManager {
|
||||
}
|
||||
|
||||
private getPreferences(document: TextDocument): Proto.UserPreferences {
|
||||
if (!this.client.apiVersion.has290Features()) {
|
||||
if (!this.client.apiVersion.gte(API.v290)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import API from '../utils/api';
|
||||
|
||||
class TypeScriptFoldingProvider implements vscode.FoldingRangeProvider {
|
||||
public constructor(
|
||||
@@ -76,7 +77,7 @@ export function register(
|
||||
): vscode.Disposable {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has280Features();
|
||||
return api.gte(API.v280);
|
||||
},
|
||||
register() {
|
||||
return vscode.languages.registerFoldingRangeProvider(selector, new TypeScriptFoldingProvider(client));
|
||||
|
||||
@@ -21,7 +21,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api: API) {
|
||||
return api.has220Features();
|
||||
return api.gte(API.v220);
|
||||
},
|
||||
register() {
|
||||
return vscode.languages.registerImplementationProvider(selector,
|
||||
|
||||
@@ -12,6 +12,7 @@ import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import { CachedNavTreeResponse, ReferencesCodeLens, TypeScriptBaseCodeLensProvider } from './baseCodeLensProvider';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import API from '../utils/api';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class TypeScriptImplementationsCodeLensProvider extends TypeScriptBaseCodeLensProvider {
|
||||
@@ -111,7 +112,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has220Features();
|
||||
return api.gte(API.v220);
|
||||
},
|
||||
register() {
|
||||
const provider = new TypeScriptImplementationsCodeLensProvider(client, modeId, cachedResponse);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Command, CommandManager } from '../utils/commandManager';
|
||||
import * as typeconverts from '../utils/typeConverters';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import API from '../utils/api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -85,7 +86,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has280Features();
|
||||
return api.gte(API.v280);
|
||||
},
|
||||
register() {
|
||||
const organizeImportsProvider = new OrganizeImportsCodeActionProvider(client, commandManager, fileConfigurationManager);
|
||||
|
||||
@@ -16,6 +16,7 @@ import BufferSyncSupport from './bufferSyncSupport';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import TelemetryReporter from '../utils/telemetry';
|
||||
import API from '../utils/api';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class ApplyCodeActionCommand implements Command {
|
||||
@@ -179,7 +180,7 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider {
|
||||
context: vscode.CodeActionContext,
|
||||
token: vscode.CancellationToken
|
||||
): Promise<vscode.CodeAction[]> {
|
||||
if (!this.client.apiVersion.has213Features()) {
|
||||
if (!this.client.apiVersion.gte(API.v213)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider {
|
||||
diagnostic: vscode.Diagnostic,
|
||||
tsAction: Proto.CodeFixAction,
|
||||
): Promise<vscode.CodeAction | undefined> {
|
||||
if (!tsAction.fixId || !this.client.apiVersion.has270Features()) {
|
||||
if (!tsAction.fixId || !this.client.apiVersion.gte(API.v270)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import FormattingOptionsManager from './fileConfigurationManager';
|
||||
import { CommandManager, Command } from '../utils/commandManager';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import API from '../utils/api';
|
||||
|
||||
class ApplyRefactoringCommand implements Command {
|
||||
public static readonly ID = '_typescript.applyRefactoring';
|
||||
@@ -211,7 +212,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has240Features();
|
||||
return api.gte(API.v240);
|
||||
},
|
||||
register() {
|
||||
return vscode.languages.registerCodeActionsProvider(selector,
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
|
||||
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import API from '../utils/api';
|
||||
|
||||
class TypeScriptReferenceSupport implements vscode.ReferenceProvider {
|
||||
public constructor(
|
||||
@@ -30,7 +31,7 @@ class TypeScriptReferenceSupport implements vscode.ReferenceProvider {
|
||||
return [];
|
||||
}
|
||||
const result: vscode.Location[] = [];
|
||||
const has203Features = this.client.apiVersion.has203Features();
|
||||
const has203Features = this.client.apiVersion.gte(API.v203);
|
||||
for (const ref of msg.body.refs) {
|
||||
if (!options.includeDeclaration && has203Features && ref.isDefinition) {
|
||||
continue;
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as typeConverters from '../utils/typeConverters';
|
||||
import { CachedNavTreeResponse, ReferencesCodeLens, TypeScriptBaseCodeLensProvider } from './baseCodeLensProvider';
|
||||
import { disposeAll } from '../utils/dispose';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import API from '../utils/api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -120,7 +121,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api) {
|
||||
return api.has206Features();
|
||||
return api.gte(API.v206);
|
||||
},
|
||||
register() {
|
||||
const referenceCodeLensProvider = new TypeScriptReferencesCodeLensProvider(client, modeId, cachedResponse);
|
||||
|
||||
@@ -21,7 +21,7 @@ export function register(
|
||||
) {
|
||||
return new VersionDependentRegistration(client, {
|
||||
isSupportedVersion(api: API) {
|
||||
return api.has213Features();
|
||||
return api.gte(API.v213);
|
||||
},
|
||||
register() {
|
||||
return vscode.languages.registerTypeDefinitionProvider(selector,
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as languageIds from '../utils/languageModeIds';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
import BufferSyncSupport from './bufferSyncSupport';
|
||||
import FileConfigurationManager from './fileConfigurationManager';
|
||||
import API from '../utils/api';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -45,7 +46,7 @@ export class UpdateImportsOnFileRenameHandler {
|
||||
oldResource: vscode.Uri,
|
||||
newResource: vscode.Uri,
|
||||
): Promise<void> {
|
||||
if (!this.client.apiVersion.has290Features) {
|
||||
if (!this.client.apiVersion.gte(API.v290)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import { LanguageDescription } from './utils/languageDescription';
|
||||
import LogDirectoryProvider from './utils/logDirectoryProvider';
|
||||
import { disposeAll } from './utils/dispose';
|
||||
import { DiagnosticKind } from './features/diagnostics';
|
||||
import API from './utils/api';
|
||||
|
||||
// Style check diagnostics that can be reported as warnings
|
||||
const styleCheckDiagnostics = [
|
||||
@@ -100,7 +101,7 @@ export default class TypeScriptServiceClientHost {
|
||||
|
||||
this.client.ensureServiceStarted();
|
||||
this.client.onReady(() => {
|
||||
if (!this.client.apiVersion.has230Features()) {
|
||||
if (!this.client.apiVersion.gte(API.v230)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
|
||||
public async openTsServerLogFile(): Promise<boolean> {
|
||||
if (!this.apiVersion.has222Features()) {
|
||||
if (!this.apiVersion.gte(API.v222)) {
|
||||
window.showErrorMessage(
|
||||
localize(
|
||||
'typescript.openTsServerLog.notSupported',
|
||||
@@ -534,7 +534,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
|
||||
private setCompilerOptionsForInferredProjects(configuration: TypeScriptServiceConfiguration): void {
|
||||
if (!this.apiVersion.has206Features()) {
|
||||
if (!this.apiVersion.gte(API.v206)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -619,7 +619,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
|
||||
public normalizePath(resource: Uri): string | null {
|
||||
if (this._apiVersion.has213Features()) {
|
||||
if (this._apiVersion.gte(API.v213)) {
|
||||
if (resource.scheme === fileSchemes.walkThroughSnippet || resource.scheme === fileSchemes.untitled) {
|
||||
const dirName = path.dirname(resource.path);
|
||||
const fileName = this.inMemoryResourcePrefix + path.basename(resource.path);
|
||||
@@ -641,11 +641,11 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
|
||||
private get inMemoryResourcePrefix(): string {
|
||||
return this._apiVersion.has270Features() ? '^' : '';
|
||||
return this._apiVersion.gte(API.v270) ? '^' : '';
|
||||
}
|
||||
|
||||
public asUrl(filepath: string): Uri {
|
||||
if (this._apiVersion.has213Features()) {
|
||||
if (this._apiVersion.gte(API.v213)) {
|
||||
if (filepath.startsWith(TypeScriptServiceClient.WALK_THROUGH_SNIPPET_SCHEME_COLON) || (filepath.startsWith(fileSchemes.untitled + ':'))
|
||||
) {
|
||||
let resource = Uri.parse(filepath);
|
||||
@@ -788,7 +788,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.apiVersion.has222Features() && this.cancellationPipeName) {
|
||||
if (this.apiVersion.gte(API.v222) && this.cancellationPipeName) {
|
||||
this.tracer.logTrace(`TypeScript Service: trying to cancel ongoing request with sequence number ${seq}`);
|
||||
try {
|
||||
fs.writeFileSync(this.cancellationPipeName + seq, '');
|
||||
@@ -951,8 +951,8 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
): Promise<string[]> {
|
||||
const args: string[] = [];
|
||||
|
||||
if (this.apiVersion.has206Features()) {
|
||||
if (this.apiVersion.has250Features()) {
|
||||
if (this.apiVersion.gte(API.v206)) {
|
||||
if (this.apiVersion.gte(API.v250)) {
|
||||
args.push('--useInferredProjectPerProjectRoot');
|
||||
} else {
|
||||
args.push('--useSingleInferredProject');
|
||||
@@ -963,16 +963,16 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
}
|
||||
|
||||
if (this.apiVersion.has208Features()) {
|
||||
if (this.apiVersion.gte(API.v208)) {
|
||||
args.push('--enableTelemetry');
|
||||
}
|
||||
|
||||
if (this.apiVersion.has222Features()) {
|
||||
if (this.apiVersion.gte(API.v222)) {
|
||||
this.cancellationPipeName = electron.getTempFile(`tscancellation-${electron.makeRandomHexString(20)}`);
|
||||
args.push('--cancellationPipeName', this.cancellationPipeName + '*');
|
||||
}
|
||||
|
||||
if (this.apiVersion.has222Features()) {
|
||||
if (this.apiVersion.gte(API.v222)) {
|
||||
if (this._configuration.tsServerLogLevel !== TsServerLogLevel.Off) {
|
||||
const logDir = await this.logDirectoryProvider.getNewLogDirectory();
|
||||
if (logDir) {
|
||||
@@ -990,7 +990,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
}
|
||||
|
||||
if (this.apiVersion.has230Features()) {
|
||||
if (this.apiVersion.gte(API.v230)) {
|
||||
const pluginPaths = this.pluginPathsProvider.getPluginPaths();
|
||||
|
||||
if (this.plugins.length) {
|
||||
@@ -1006,20 +1006,20 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
}
|
||||
|
||||
if (this.apiVersion.has234Features()) {
|
||||
if (this.apiVersion.gte(API.v234)) {
|
||||
if (this._configuration.npmLocation) {
|
||||
args.push('--npmLocation', `"${this._configuration.npmLocation}"`);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.apiVersion.has260Features()) {
|
||||
if (this.apiVersion.gte(API.v260)) {
|
||||
const tsLocale = getTsLocale(this._configuration);
|
||||
if (tsLocale) {
|
||||
args.push('--locale', tsLocale);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.apiVersion.has291Features()) {
|
||||
if (this.apiVersion.gte(API.v291)) {
|
||||
args.push('--noGetErrOnBackgroundUpdate');
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,29 @@ import * as semver from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
import { memoize } from './memoize';
|
||||
|
||||
|
||||
export default class API {
|
||||
public static readonly defaultVersion = new API('1.0.0', '1.0.0');
|
||||
private static fromSimpleString(value: string): API {
|
||||
return new API(value, value);
|
||||
}
|
||||
|
||||
public static readonly defaultVersion = API.fromSimpleString('1.0.0');
|
||||
public static readonly v203 = API.fromSimpleString('2.0.3');
|
||||
public static readonly v206 = API.fromSimpleString('2.0.6');
|
||||
public static readonly v208 = API.fromSimpleString('2.0.8');
|
||||
public static readonly v213 = API.fromSimpleString('2.1.3');
|
||||
public static readonly v220 = API.fromSimpleString('2.2.0');
|
||||
public static readonly v222 = API.fromSimpleString('2.2.2');
|
||||
public static readonly v230 = API.fromSimpleString('2.3.0');
|
||||
public static readonly v234 = API.fromSimpleString('2.3.4');
|
||||
public static readonly v240 = API.fromSimpleString('2.4.0');
|
||||
public static readonly v250 = API.fromSimpleString('2.5.0');
|
||||
public static readonly v260 = API.fromSimpleString('2.6.0');
|
||||
public static readonly v262 = API.fromSimpleString('2.6.2');
|
||||
public static readonly v270 = API.fromSimpleString('2.7.0');
|
||||
public static readonly v280 = API.fromSimpleString('2.8.0');
|
||||
public static readonly v290 = API.fromSimpleString('2.9.0');
|
||||
public static readonly v291 = API.fromSimpleString('2.9.1');
|
||||
|
||||
|
||||
public static fromVersionString(versionString: string): API {
|
||||
let version = semver.valid(versionString);
|
||||
@@ -32,83 +50,7 @@ export default class API {
|
||||
private readonly version: string
|
||||
) { }
|
||||
|
||||
@memoize
|
||||
public has203Features(): boolean {
|
||||
return semver.gte(this.version, '2.0.3');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has206Features(): boolean {
|
||||
return semver.gte(this.version, '2.0.6');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has208Features(): boolean {
|
||||
return semver.gte(this.version, '2.0.8');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has213Features(): boolean {
|
||||
return semver.gte(this.version, '2.1.3');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has220Features(): boolean {
|
||||
return semver.gte(this.version, '2.2.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has222Features(): boolean {
|
||||
return semver.gte(this.version, '2.2.2');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has230Features(): boolean {
|
||||
return semver.gte(this.version, '2.3.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has234Features(): boolean {
|
||||
return semver.gte(this.version, '2.3.4');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has240Features(): boolean {
|
||||
return semver.gte(this.version, '2.4.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has250Features(): boolean {
|
||||
return semver.gte(this.version, '2.5.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has260Features(): boolean {
|
||||
return semver.gte(this.version, '2.6.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has262Features(): boolean {
|
||||
return semver.gte(this.version, '2.6.2');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has270Features(): boolean {
|
||||
return semver.gte(this.version, '2.7.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has280Features(): boolean {
|
||||
return semver.gte(this.version, '2.8.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has290Features(): boolean {
|
||||
return semver.gte(this.version, '2.9.0');
|
||||
}
|
||||
|
||||
@memoize
|
||||
public has291Features(): boolean {
|
||||
return semver.gte(this.version, '2.9.1');
|
||||
public gte(other: API): boolean {
|
||||
return semver.gte(this.version, other.version);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { dirname } from 'path';
|
||||
import { openOrCreateConfigFile, isImplicitProjectConfigFile } from './tsconfig';
|
||||
import * as languageModeIds from '../utils/languageModeIds';
|
||||
import TelemetryReporter from './telemetry';
|
||||
import API from './api';
|
||||
|
||||
const localize = loadMessageBundle();
|
||||
const selector = [languageModeIds.javascript, languageModeIds.javascriptreact];
|
||||
@@ -193,7 +194,7 @@ export function create(
|
||||
return vscode.window.showInformationMessage(message);
|
||||
}));
|
||||
|
||||
if (client.apiVersion.has213Features()) {
|
||||
if (client.apiVersion.gte(API.v213)) {
|
||||
toDispose.push(createLargeProjectMonitorFromTypeScript(item, client));
|
||||
} else {
|
||||
toDispose.push(...createLargeProjectMonitorForProject(item, client, isOpen, memento));
|
||||
|
||||
Reference in New Issue
Block a user