mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Apply auto fix on save actions sequentially and make sure we request fixes of the specific type we are interested in
This commit is contained in:
@@ -38,7 +38,7 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
|
||||
context: vscode.CodeActionContext,
|
||||
token: vscode.CancellationToken
|
||||
): Promise<vscode.CodeAction[] | undefined> {
|
||||
if (!context.only || !context.only.contains(vscode.CodeActionKind.Source)) {
|
||||
if (!context.only || !(context.only.contains(vscode.CodeActionKind.SourceAutoFix) || vscode.CodeActionKind.SourceAutoFix.contains(context.only))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,14 +82,14 @@ export class OrganizeImportsCodeActionProvider implements vscode.CodeActionProvi
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!context.only || !context.only.contains(vscode.CodeActionKind.SourceOrganizeImports)) {
|
||||
if (!context.only || !(context.only.contains(vscode.CodeActionKind.SourceOrganizeImports) || vscode.CodeActionKind.SourceOrganizeImports.contains(context.only))) {
|
||||
return [];
|
||||
}
|
||||
|
||||
this.fileConfigManager.ensureConfigurationForDocument(document, token);
|
||||
|
||||
const action = new vscode.CodeAction(
|
||||
localize('oraganizeImportsAction.title', "Organize Imports"),
|
||||
localize('organizeImportsAction.title', "Organize Imports"),
|
||||
vscode.CodeActionKind.SourceOrganizeImports);
|
||||
action.command = { title: '', command: OrganizeImportsCommand.Id, arguments: [file] };
|
||||
return [action];
|
||||
|
||||
Reference in New Issue
Block a user