-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: cover more code action kind in codeActionGroups #193356
base: main
Are you sure you want to change the base?
fix: cover more code action kind in codeActionGroups #193356
Conversation
} | ||
|
||
const uncategorizedCodeActionGroup = Object.freeze<ActionGroup>({ kind: CodeActionKind.Empty, title: localize('codeAction.widget.id.more', 'More Actions...') }); | ||
|
||
const codeActionGroups = Object.freeze<ActionGroup[]>([ | ||
{ kind: CodeActionKind.QuickFix, title: localize('codeAction.widget.id.quickfix', 'Quick Fix') }, | ||
{ kind: CodeActionKind.Refactor, title: localize('codeAction.widget.id.refactor', 'Refactor'), icon: Codicon.wrench, exact: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very sure where these localize keys are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without setting this to exact match it'll catch all following sub action kinds
{ kind: CodeActionKind.RefactorExtract, title: localize('codeAction.widget.id.extract', 'Extract'), icon: Codicon.wrench }, | ||
{ kind: CodeActionKind.RefactorInline, title: localize('codeAction.widget.id.inline', 'Inline'), icon: Codicon.wrench }, | ||
{ kind: CodeActionKind.RefactorRewrite, title: localize('codeAction.widget.id.convert', 'Rewrite'), icon: Codicon.wrench }, | ||
{ kind: CodeActionKind.RefactorMove, title: localize('codeAction.widget.id.move', 'Move'), icon: Codicon.wrench }, | ||
{ kind: CodeActionKind.SurroundWith, title: localize('codeAction.widget.id.surround', 'Surround With'), icon: Codicon.symbolSnippet }, | ||
{ kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action'), icon: Codicon.symbolFile }, | ||
{ kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action'), icon: Codicon.symbolFile, exact: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change existing behavior so might need discussion
{ kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action'), icon: Codicon.symbolFile }, | ||
{ kind: CodeActionKind.Source, title: localize('codeAction.widget.id.source', 'Source Action'), icon: Codicon.symbolFile, exact: true }, | ||
{ kind: CodeActionKind.SourceFixAll, title: localize('codeAction.widget.id.source.fixAll', 'Source Action Fix All'), icon: Codicon.symbolFile }, | ||
{ kind: CodeActionKind.SourceOrganizeImports, title: localize('codeAction.widget.id.source.organizeImports', 'Source Action Organize Imports'), icon: Codicon.symbolFile }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Question]: Is it better to keep the order as same as the documentation? It's doable via typecheck but I couldn't find any existing types to reuse https://code.visualstudio.com/api/references/vscode-api#CodeActionKind
@mjbvz this may actually help in this PR regarding #191854. ideally, I'd like to isolate quickfixes based on a more specific type, not show refactorings in a small subset of cases, or be able to differentiate between a regular atm, from CodeActionKind, you can only see if the |
close #193355
This is a sample PR for discussion for now.