Move code action documentation contribution point to come from metadata

For #86788
This commit is contained in:
Matt Bierner
2020-02-11 11:36:10 -08:00
parent 7a1ab29427
commit fb622a8b83
13 changed files with 143 additions and 43 deletions

View File

@@ -8,7 +8,8 @@ import { Command } from '../utils/commandManager';
import { isTypeScriptDocument } from '../utils/languageModeIds';
export class LearnMoreAboutRefactoringsCommand implements Command {
public readonly id = '_typescript.learnMoreAboutRefactorings';
public static readonly id = '_typescript.learnMoreAboutRefactorings';
public readonly id = LearnMoreAboutRefactoringsCommand.id;
public execute() {
const docUrl = vscode.window.activeTextEditor && isTypeScriptDocument(vscode.window.activeTextEditor.document)

View File

@@ -5,16 +5,17 @@
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { LearnMoreAboutRefactoringsCommand } from '../commands/learnMoreAboutRefactorings';
import type * as Proto from '../protocol';
import { ITypeScriptServiceClient } from '../typescriptService';
import API from '../utils/api';
import { nulToken } from '../utils/cancellation';
import { Command, CommandManager } from '../utils/commandManager';
import { VersionDependentRegistration } from '../utils/dependentRegistration';
import * as fileSchemes from '../utils/fileSchemes';
import { TelemetryReporter } from '../utils/telemetry';
import * as typeConverters from '../utils/typeConverters';
import FormattingOptionsManager from './fileConfigurationManager';
import * as fileSchemes from '../utils/fileSchemes';
const localize = nls.loadMessageBundle();
@@ -209,6 +210,15 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
vscode.CodeActionKind.Refactor,
...allKnownCodeActionKinds.map(x => x.kind),
],
documentation: [
{
kind: vscode.CodeActionKind.Refactor,
command: {
command: LearnMoreAboutRefactoringsCommand.id,
title: localize('refactor.documentation.title', "Learn more about JS/TS refactorings")
}
}
]
};
public async provideCodeActions(