Remove gating for TS versions < 2.4
Telemetry shows that these old TS versions have very low usage (in the tens across the many, many js/ts users). Given this, it now makes sense to remove the extra gating/checks required to support these old versions
This commit is contained in:
parent
0d0a574164
commit
46d2224d8b
8 changed files with 32 additions and 74 deletions
|
@ -176,6 +176,7 @@ class SyncedBuffer {
|
|||
const args: Proto.OpenRequestArgs = {
|
||||
file: this.filepath,
|
||||
fileContent: this.document.getText(),
|
||||
projectRootPath: this.client.getWorkspaceRootForResource(this.document.uri),
|
||||
};
|
||||
|
||||
const scriptKind = mode2ScriptKind(this.document.languageId);
|
||||
|
@ -183,10 +184,6 @@ class SyncedBuffer {
|
|||
args.scriptKindName = scriptKind;
|
||||
}
|
||||
|
||||
if (this.client.apiVersion.gte(API.v230)) {
|
||||
args.projectRootPath = this.client.getWorkspaceRootForResource(this.document.uri);
|
||||
}
|
||||
|
||||
if (this.client.apiVersion.gte(API.v240)) {
|
||||
const tsPluginsForDocument = this.client.pluginManager.plugins
|
||||
.filter(x => x.languages.indexOf(this.document.languageId) >= 0);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
@ -36,7 +34,6 @@ const directives: Directive[] = [
|
|||
];
|
||||
|
||||
class DirectiveCommentCompletionProvider implements vscode.CompletionItemProvider {
|
||||
public static readonly minVersion = API.v230;
|
||||
|
||||
constructor(
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
|
@ -71,9 +68,7 @@ export function register(
|
|||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, DirectiveCommentCompletionProvider.minVersion, () => {
|
||||
return vscode.languages.registerCompletionItemProvider(selector,
|
||||
new DirectiveCommentCompletionProvider(client),
|
||||
'@');
|
||||
});
|
||||
return vscode.languages.registerCompletionItemProvider(selector,
|
||||
new DirectiveCommentCompletionProvider(client),
|
||||
'@');
|
||||
}
|
||||
|
|
|
@ -5,13 +5,9 @@
|
|||
|
||||
import * as vscode from 'vscode';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import DefinitionProviderBase from './definitionProviderBase';
|
||||
|
||||
class TypeScriptImplementationProvider extends DefinitionProviderBase implements vscode.ImplementationProvider {
|
||||
public static readonly minVersion = API.v220;
|
||||
|
||||
public provideImplementation(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Promise<vscode.Definition | undefined> {
|
||||
return this.getSymbolLocations('implementation', document, position, token);
|
||||
}
|
||||
|
@ -21,8 +17,6 @@ export function register(
|
|||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, TypeScriptImplementationProvider.minVersion, () => {
|
||||
return vscode.languages.registerImplementationProvider(selector,
|
||||
new TypeScriptImplementationProvider(client));
|
||||
});
|
||||
}
|
||||
return vscode.languages.registerImplementationProvider(selector,
|
||||
new TypeScriptImplementationProvider(client));
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@ import * as nls from 'vscode-nls';
|
|||
import * as Proto from '../protocol';
|
||||
import * as PConst from '../protocol.const';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { ConfigurationDependentRegistration, VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import { ConfigurationDependentRegistration } from '../utils/dependentRegistration';
|
||||
import { TypeScriptBaseCodeLensProvider, ReferencesCodeLens, getSymbolRange } from './baseCodeLensProvider';
|
||||
import { CachedResponse } from '../tsServer/cachedResponse';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
@ -17,7 +16,6 @@ import * as typeConverters from '../utils/typeConverters';
|
|||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export default class TypeScriptImplementationsCodeLensProvider extends TypeScriptBaseCodeLensProvider {
|
||||
public static readonly minVersion = API.v220;
|
||||
|
||||
public async resolveCodeLens(
|
||||
inputCodeLens: vscode.CodeLens,
|
||||
|
@ -96,9 +94,8 @@ export function register(
|
|||
client: ITypeScriptServiceClient,
|
||||
cachedResponse: CachedResponse<Proto.NavTreeResponse>,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, TypeScriptImplementationsCodeLensProvider.minVersion, () =>
|
||||
new ConfigurationDependentRegistration(modeId, 'implementationsCodeLens.enabled', () => {
|
||||
return vscode.languages.registerCodeLensProvider(selector,
|
||||
new TypeScriptImplementationsCodeLensProvider(client, cachedResponse));
|
||||
}));
|
||||
return new ConfigurationDependentRegistration(modeId, 'implementationsCodeLens.enabled', () => {
|
||||
return vscode.languages.registerCodeLensProvider(selector,
|
||||
new TypeScriptImplementationsCodeLensProvider(client, cachedResponse));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ export class TypeScriptServerSpawner {
|
|||
|
||||
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(kind, configuration, version, apiVersion, pluginManager);
|
||||
|
||||
if (TypeScriptServerSpawner.isLoggingEnabled(apiVersion, configuration)) {
|
||||
if (TypeScriptServerSpawner.isLoggingEnabled(configuration)) {
|
||||
if (tsServerLogFile) {
|
||||
this._logger.info(`<${kind}> Log file: ${tsServerLogFile}`);
|
||||
} else {
|
||||
|
@ -103,9 +103,8 @@ export class TypeScriptServerSpawner {
|
|||
currentVersion: TypeScriptVersion,
|
||||
apiVersion: API,
|
||||
pluginManager: PluginManager,
|
||||
): { args: string[], cancellationPipeName: string | undefined, tsServerLogFile: string | undefined } {
|
||||
): { args: string[], cancellationPipeName: string, tsServerLogFile: string | undefined } {
|
||||
const args: string[] = [];
|
||||
let cancellationPipeName: string | undefined;
|
||||
let tsServerLogFile: string | undefined;
|
||||
|
||||
if (kind === 'syntax') {
|
||||
|
@ -126,12 +125,10 @@ export class TypeScriptServerSpawner {
|
|||
args.push('--enableTelemetry');
|
||||
}
|
||||
|
||||
if (apiVersion.gte(API.v222)) {
|
||||
cancellationPipeName = electron.getTempFile('tscancellation');
|
||||
args.push('--cancellationPipeName', cancellationPipeName + '*');
|
||||
}
|
||||
const cancellationPipeName = electron.getTempFile('tscancellation');
|
||||
args.push('--cancellationPipeName', cancellationPipeName + '*');
|
||||
|
||||
if (TypeScriptServerSpawner.isLoggingEnabled(apiVersion, configuration)) {
|
||||
if (TypeScriptServerSpawner.isLoggingEnabled(configuration)) {
|
||||
const logDir = this._logDirectoryProvider.getNewLogDirectory();
|
||||
if (logDir) {
|
||||
tsServerLogFile = path.join(logDir, `tsserver.log`);
|
||||
|
@ -140,29 +137,25 @@ export class TypeScriptServerSpawner {
|
|||
}
|
||||
}
|
||||
|
||||
if (apiVersion.gte(API.v230)) {
|
||||
const pluginPaths = this._pluginPathsProvider.getPluginPaths();
|
||||
const pluginPaths = this._pluginPathsProvider.getPluginPaths();
|
||||
|
||||
if (pluginManager.plugins.length) {
|
||||
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
|
||||
if (pluginManager.plugins.length) {
|
||||
args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
|
||||
|
||||
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
|
||||
for (const plugin of pluginManager.plugins) {
|
||||
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
|
||||
pluginPaths.push(plugin.path);
|
||||
}
|
||||
const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
|
||||
for (const plugin of pluginManager.plugins) {
|
||||
if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
|
||||
pluginPaths.push(plugin.path);
|
||||
}
|
||||
}
|
||||
|
||||
if (pluginPaths.length !== 0) {
|
||||
args.push('--pluginProbeLocations', pluginPaths.join(','));
|
||||
}
|
||||
}
|
||||
|
||||
if (apiVersion.gte(API.v234)) {
|
||||
if (configuration.npmLocation) {
|
||||
args.push('--npmLocation', `"${configuration.npmLocation}"`);
|
||||
}
|
||||
if (pluginPaths.length !== 0) {
|
||||
args.push('--pluginProbeLocations', pluginPaths.join(','));
|
||||
}
|
||||
|
||||
if (configuration.npmLocation) {
|
||||
args.push('--npmLocation', `"${configuration.npmLocation}"`);
|
||||
}
|
||||
|
||||
if (apiVersion.gte(API.v260)) {
|
||||
|
@ -195,9 +188,8 @@ export class TypeScriptServerSpawner {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
private static isLoggingEnabled(apiVersion: API, configuration: TypeScriptServiceConfiguration) {
|
||||
return apiVersion.gte(API.v222) &&
|
||||
configuration.tsServerLogLevel !== TsServerLogLevel.Off;
|
||||
private static isLoggingEnabled(configuration: TypeScriptServiceConfiguration) {
|
||||
return configuration.tsServerLogLevel !== TsServerLogLevel.Off;
|
||||
}
|
||||
|
||||
private static getTsLocale(configuration: TypeScriptServiceConfiguration): string {
|
||||
|
|
|
@ -15,7 +15,6 @@ import LanguageProvider from './languageProvider';
|
|||
import * as Proto from './protocol';
|
||||
import * as PConst from './protocol.const';
|
||||
import TypeScriptServiceClient from './typescriptServiceClient';
|
||||
import API from './utils/api';
|
||||
import { CommandManager } from './utils/commandManager';
|
||||
import { Disposable } from './utils/dispose';
|
||||
import { DiagnosticLanguage, LanguageDescription } from './utils/languageDescription';
|
||||
|
@ -105,10 +104,6 @@ export default class TypeScriptServiceClientHost extends Disposable {
|
|||
|
||||
this.client.ensureServiceStarted();
|
||||
this.client.onReady(() => {
|
||||
if (this.client.apiVersion.lt(API.v230)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const languages = new Set<string>();
|
||||
for (const plugin of pluginManager.plugins) {
|
||||
for (const language of plugin.languages) {
|
||||
|
|
|
@ -392,14 +392,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
}
|
||||
|
||||
public async openTsServerLogFile(): Promise<boolean> {
|
||||
if (this.apiVersion.lt(API.v222)) {
|
||||
vscode.window.showErrorMessage(
|
||||
localize(
|
||||
'typescript.openTsServerLog.notSupported',
|
||||
'TS Server logging requires TS 2.2.2+'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._configuration.tsServerLogLevel === TsServerLogLevel.Off) {
|
||||
vscode.window.showErrorMessage<vscode.MessageItem>(
|
||||
localize(
|
||||
|
|
|
@ -14,10 +14,6 @@ export default class API {
|
|||
}
|
||||
|
||||
public static readonly defaultVersion = API.fromSimpleString('1.0.0');
|
||||
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');
|
||||
|
|
Loading…
Reference in a new issue