Conversation
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
Maybe CodeActionKind is the better name because this is about the 'character' of a code action and because we have been using ...Kind already for similar purposes...
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
Not sure if the Refactor-prefix is needed? Isn't this implicit?
src/vs/vscode.d.ts
Outdated
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
Do we have an use-case for this?
There was a problem hiding this comment.
Yes, this is used for the requestedScope logic in the TS refactoring code action provider so that we can skip computing code actions that vscode will filter out later
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
Maybe use a for with for select-semantics, like only?
There was a problem hiding this comment.
getting a little messy... can we fold both args into one request object and pass that along?
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
We should also have static readonly Rewrite for things like 'Convert if-else into ternary statement' etc, etc
There was a problem hiding this comment.
and also maybe CleanUp category?
src/vs/vscode.d.ts
Outdated
499b465 to
2a7d23d
Compare
|
Thanks for the feedback. Pushed change that updates the names as suggested. I'll also look into cleaning up the trigger implementation flow. The new change also allows for callers of
|
ghost
left a comment
There was a problem hiding this comment.
I think cAmEl is good for naming class's. Like codeActionKind
Take args as an object instead of as an array of values
dfba759 to
5f68a21
Compare
|
Most recent change makes the keybindings for this more like
|
59a30c7 to
0c30b3f
Compare
|
Will follow up with changes to expose a new "refactor" action with keybinding, as well as hooking up more of the TS quick fixes / refactorings to use |
Fixes #41048
Problem
We'd like to improve the UX for refactorings. Two specific ideas:
Proposal
Introduce a new
CodeActionScopetype. This identifies the class/type of a given refactoring. All refactoring code actions for example would have a scope ofrefactor.*, with an extract method refactoring action having a scope ofrefactor.extract.methodFor the refactoring context menu, we use
CodeActionScopeto filter out any code actions that are not refactorings. TheCodeActionContextwill also have a scope field on it that aCodeActionProvidercan use to determine which code actions to compute and returnFor keybindings, we can setup a keybinding such as:
{ "key": "ctrl+shift+.", "command": "editor.action.codeAction", "args": [ "refactor.extract" ] }where
"refactor"is treated as the code action scope. Only code actions of the type"refactor.*"should be shownTodo
Still a lot to do on this PR
CodeActionContexteditor.action.codeActioncommand instead of overloading the existingeditor.action.quickFixcommand