-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
CodeAction api change proposal #34664
Comments
@mjbvz Something I thought while writing some jsdoc is if we should just make the export class CodeAction {
//...
edits?: TextEdit[] | WorkspaceEdit; have this export class CodeAction {
//...
edit: WorkspaceEdit; Thoughts? Ideas? |
I'm fine with this. I think we should keep |
Pushed 966100d with this: edit?: WorkspaceEdit; |
Follow up on #34597 and #34595, as part of #33555
Problem
#33555 describes a few key issues with using code actions for refactorings. Along with these concerns, we'd also like to be able to do the following:
Proposal
This proposal subsumes the proposals of #34597 and #34595 and is based on discussions @kieferrm and I had. It is based on the following observations:
This proposal extends the CodeAction API to let us differentiate between quick fixes and refactorings. Using this, we can then specialized the UX for each of theses
VS Code API Changes
Code action context menu UX changes
Using the additional information provided by the new
CodeAction
interface, we would update the code action context menu to display the following:CodeActionType
to differentiate types of code actions.QuickFix
code actions, also use diagnostic severity to display a different symbol for quick fixes for errors and quick fixes for warningsCode action trigger changes
Using the
CodeActionType
, we can now differentiate quick fixes and refactorings. We would then change when we show each type:The existing lightbulb /
editor.action.quickFix
would request code actions withCodeActionType.Standard
andCodeActionType.QuickFix
. Refactoring code actions would be filtered out.A new
editor.action.refactor
command would request code actions only ofCodeActionType.Refactor
and display these in the context menuKeybinding for code actions
Introduce a new
editor.action.codeAction
command. This command would take an optional list of code action ids.When the command is triggered, it would request all code actions that are currently available, but only show those that match the requested
ids
. If only a single code action matches the id, it would be applied automaticallyThis would allow us to setup keybindings such as:
The text was updated successfully, but these errors were encountered: