From 2d7655cb161a2cd79b2940069a89d0c3edd80812 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 16 Sep 2022 13:51:00 -0700 Subject: [PATCH] Add Refactor.move and Refactor.inline to code action widget (#161134) Fixes #158515 Also aligns the icon to be more consistent with how they are used: - Surround with snippets use snippet icon - All refactorings use the wrench icon - Remove custom color which was added to some refactorings but not others --- .../contrib/codeAction/browser/codeActionMenu.ts | 10 ++++++---- src/vs/editor/contrib/codeAction/browser/types.ts | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts b/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts index e2ac743357ab0..5f907a2674082 100644 --- a/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts +++ b/src/vs/editor/contrib/codeAction/browser/codeActionMenu.ts @@ -86,10 +86,12 @@ const uncategorizedCodeActionGroup = Object.freeze({ kind: Code const codeActionGroups = Object.freeze([ { kind: CodeActionKind.QuickFix, title: localize('codeAction.widget.id.quickfix', 'Quick Fix...') }, - { kind: CodeActionKind.Extract, title: localize('codeAction.widget.id.extract', 'Extract...'), icon: { codicon: Codicon.wrench } }, - { kind: CodeActionKind.Convert, title: localize('codeAction.widget.id.convert', 'Convert...'), icon: { codicon: Codicon.zap, color: 'var(--vscode-editorLightBulbAutoFix-foreground)' } }, - { kind: CodeActionKind.SurroundWith, title: localize('codeAction.widget.id.surround', 'Surround With...'), icon: { codicon: Codicon.symbolArray } }, - { kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action...'), icon: { codicon: Codicon.lightBulb, color: 'var(--vscode-editorLightBulb-foreground)' } }, + { kind: CodeActionKind.RefactorExtract, title: localize('codeAction.widget.id.extract', 'Extract...'), icon: { codicon: Codicon.wrench } }, + { kind: CodeActionKind.RefactorInline, title: localize('codeAction.widget.id.inline', 'Inline...'), icon: { codicon: Codicon.wrench } }, + { kind: CodeActionKind.RefactorRewrite, title: localize('codeAction.widget.id.convert', 'Rewrite...'), icon: { codicon: Codicon.wrench } }, + { kind: CodeActionKind.RefactorMove, title: localize('codeAction.widget.id.move', 'Move...'), icon: { codicon: Codicon.wrench } }, + { kind: CodeActionKind.SurroundWith, title: localize('codeAction.widget.id.surround', 'Surround With...'), icon: { codicon: Codicon.symbolSnippet } }, + { kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action...'), icon: { codicon: Codicon.symbolFile } }, uncategorizedCodeActionGroup, ]); diff --git a/src/vs/editor/contrib/codeAction/browser/types.ts b/src/vs/editor/contrib/codeAction/browser/types.ts index b7db8beaf6327..106f5b444b466 100644 --- a/src/vs/editor/contrib/codeAction/browser/types.ts +++ b/src/vs/editor/contrib/codeAction/browser/types.ts @@ -13,8 +13,10 @@ export class CodeActionKind { public static readonly Empty = new CodeActionKind(''); public static readonly QuickFix = new CodeActionKind('quickfix'); public static readonly Refactor = new CodeActionKind('refactor'); - public static readonly Extract = CodeActionKind.Refactor.append('extract'); - public static readonly Convert = CodeActionKind.Refactor.append('rewrite'); + public static readonly RefactorExtract = CodeActionKind.Refactor.append('extract'); + public static readonly RefactorInline = CodeActionKind.Refactor.append('inline'); + public static readonly RefactorMove = CodeActionKind.Refactor.append('move'); + public static readonly RefactorRewrite = CodeActionKind.Refactor.append('rewrite'); public static readonly Source = new CodeActionKind('source'); public static readonly SourceOrganizeImports = CodeActionKind.Source.append('organizeImports'); public static readonly SourceFixAll = CodeActionKind.Source.append('fixAll');