mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Move min versions into jt/ts feature providers
This commit is contained in:
@@ -36,6 +36,8 @@ const directives: Directive[] = [
|
||||
];
|
||||
|
||||
class DirectiveCommentCompletionProvider implements vscode.CompletionItemProvider {
|
||||
public static readonly minVersion = API.v230;
|
||||
|
||||
constructor(
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
) { }
|
||||
@@ -69,7 +71,7 @@ export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v230, () => {
|
||||
return new VersionDependentRegistration(client, DirectiveCommentCompletionProvider.minVersion, () => {
|
||||
return vscode.languages.registerCompletionItemProvider(selector,
|
||||
new DirectiveCommentCompletionProvider(client),
|
||||
'@');
|
||||
|
||||
@@ -11,6 +11,8 @@ import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
class TypeScriptFoldingProvider implements vscode.FoldingRangeProvider {
|
||||
public static readonly minVersion = API.v280;
|
||||
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient
|
||||
) { }
|
||||
@@ -75,7 +77,7 @@ export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
): vscode.Disposable {
|
||||
return new VersionDependentRegistration(client, API.v280, () => {
|
||||
return new VersionDependentRegistration(client, TypeScriptFoldingProvider.minVersion, () => {
|
||||
return vscode.languages.registerFoldingRangeProvider(selector,
|
||||
new TypeScriptFoldingProvider(client));
|
||||
});
|
||||
|
||||
@@ -10,6 +10,8 @@ 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);
|
||||
}
|
||||
@@ -19,7 +21,7 @@ export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v220, () => {
|
||||
return new VersionDependentRegistration(client, TypeScriptImplementationProvider.minVersion, () => {
|
||||
return vscode.languages.registerImplementationProvider(selector,
|
||||
new TypeScriptImplementationProvider(client));
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ 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,
|
||||
@@ -95,7 +96,7 @@ export function register(
|
||||
client: ITypeScriptServiceClient,
|
||||
cachedResponse: CachedResponse<Proto.NavTreeResponse>,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v220, () =>
|
||||
return new VersionDependentRegistration(client, TypeScriptImplementationsCodeLensProvider.minVersion, () =>
|
||||
new ConfigurationDependentRegistration(modeId, 'implementationsCodeLens.enabled', () => {
|
||||
return vscode.languages.registerCodeLensProvider(selector,
|
||||
new TypeScriptImplementationsCodeLensProvider(client, cachedResponse));
|
||||
|
||||
@@ -57,6 +57,8 @@ class OrganizeImportsCommand implements Command {
|
||||
}
|
||||
|
||||
export class OrganizeImportsCodeActionProvider implements vscode.CodeActionProvider {
|
||||
public static readonly minVersion = API.v280;
|
||||
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
commandManager: CommandManager,
|
||||
@@ -103,7 +105,7 @@ export function register(
|
||||
fileConfigurationManager: FileConfigurationManager,
|
||||
telemetryReporter: TelemetryReporter,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v280, () => {
|
||||
return new VersionDependentRegistration(client, OrganizeImportsCodeActionProvider.minVersion, () => {
|
||||
const organizeImportsProvider = new OrganizeImportsCodeActionProvider(client, commandManager, fileConfigurationManager, telemetryReporter);
|
||||
return vscode.languages.registerCodeActionsProvider(selector,
|
||||
organizeImportsProvider,
|
||||
|
||||
@@ -174,6 +174,7 @@ class SupportedCodeActionProvider {
|
||||
}
|
||||
|
||||
class TypeScriptQuickFixProvider implements vscode.CodeActionProvider {
|
||||
public static readonly minVersion = API.v213;
|
||||
|
||||
public static readonly metadata: vscode.CodeActionProviderMetadata = {
|
||||
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix]
|
||||
@@ -326,7 +327,7 @@ export function register(
|
||||
diagnosticsManager: DiagnosticsManager,
|
||||
telemetryReporter: TelemetryReporter
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v213, () =>
|
||||
return new VersionDependentRegistration(client, TypeScriptQuickFixProvider.minVersion, () =>
|
||||
vscode.languages.registerCodeActionsProvider(selector,
|
||||
new TypeScriptQuickFixProvider(client, fileConfigurationManager, commandManager, diagnosticsManager, telemetryReporter),
|
||||
TypeScriptQuickFixProvider.metadata));
|
||||
|
||||
@@ -112,6 +112,8 @@ class SelectRefactorCommand implements Command {
|
||||
}
|
||||
|
||||
class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
public static readonly minVersion = API.v240;
|
||||
|
||||
private static readonly extractFunctionKind = vscode.CodeActionKind.RefactorExtract.append('function');
|
||||
private static readonly extractConstantKind = vscode.CodeActionKind.RefactorExtract.append('constant');
|
||||
private static readonly moveKind = vscode.CodeActionKind.Refactor.append('move');
|
||||
@@ -236,7 +238,7 @@ export function register(
|
||||
commandManager: CommandManager,
|
||||
telemetryReporter: TelemetryReporter,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v240, () => {
|
||||
return new VersionDependentRegistration(client, TypeScriptRefactorProvider.minVersion, () => {
|
||||
return vscode.languages.registerCodeActionsProvider(selector,
|
||||
new TypeScriptRefactorProvider(client, formattingOptionsManager, commandManager, telemetryReporter),
|
||||
TypeScriptRefactorProvider.metadata);
|
||||
|
||||
@@ -17,6 +17,7 @@ import { CachedResponse } from '../tsServer/cachedResponse';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvider {
|
||||
public static readonly minVersion = API.v206;
|
||||
|
||||
public async resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
|
||||
const codeLens = inputCodeLens as ReferencesCodeLens;
|
||||
@@ -98,7 +99,7 @@ export function register(
|
||||
client: ITypeScriptServiceClient,
|
||||
cachedResponse: CachedResponse<Proto.NavTreeResponse>,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v206, () =>
|
||||
return new VersionDependentRegistration(client, TypeScriptReferencesCodeLensProvider.minVersion, () =>
|
||||
new ConfigurationDependentRegistration(modeId, 'referencesCodeLens.enabled', () => {
|
||||
return vscode.languages.registerCodeLensProvider(selector,
|
||||
new TypeScriptReferencesCodeLensProvider(client, cachedResponse));
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Disposable } from '../utils/dispose';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
class TagClosing extends Disposable {
|
||||
public static readonly minVersion = API.v300;
|
||||
|
||||
private _disposed = false;
|
||||
private _timeout: NodeJS.Timer | undefined = undefined;
|
||||
@@ -167,7 +168,7 @@ export function register(
|
||||
modeId: string,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v300, () =>
|
||||
return new VersionDependentRegistration(client, TagClosing.minVersion, () =>
|
||||
new ConfigurationDependentRegistration(modeId, 'autoClosingTags', () =>
|
||||
new ActiveDocumentDependentRegistration(selector, () =>
|
||||
new TagClosing(client))));
|
||||
|
||||
@@ -10,6 +10,8 @@ import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import DefinitionProviderBase from './definitionProviderBase';
|
||||
|
||||
export default class TypeScriptTypeDefinitionProvider extends DefinitionProviderBase implements vscode.TypeDefinitionProvider {
|
||||
public static readonly minVersion = API.v213;
|
||||
|
||||
public provideTypeDefinition(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Promise<vscode.Definition | undefined> {
|
||||
return this.getSymbolLocations('typeDefinition', document, position, token);
|
||||
}
|
||||
@@ -19,7 +21,7 @@ export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v213, () => {
|
||||
return new VersionDependentRegistration(client, TypeScriptTypeDefinitionProvider.minVersion, () => {
|
||||
return vscode.languages.registerTypeDefinitionProvider(selector,
|
||||
new TypeScriptTypeDefinitionProvider(client));
|
||||
});
|
||||
|
||||
@@ -40,6 +40,8 @@ enum UpdateImportsOnFileMoveSetting {
|
||||
}
|
||||
|
||||
class UpdateImportsOnFileRenameHandler extends Disposable {
|
||||
public static minVersion = API.v300;
|
||||
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
private readonly fileConfigurationManager: FileConfigurationManager,
|
||||
@@ -233,6 +235,6 @@ export function register(
|
||||
fileConfigurationManager: FileConfigurationManager,
|
||||
handles: (uri: vscode.Uri) => Promise<boolean>,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, API.v300, () =>
|
||||
return new VersionDependentRegistration(client, UpdateImportsOnFileRenameHandler.minVersion, () =>
|
||||
new UpdateImportsOnFileRenameHandler(client, fileConfigurationManager, handles));
|
||||
}
|
||||
Reference in New Issue
Block a user