You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve workflow for applying/previewing fixes #156886
WorkspaceEdit is a type in the VS Code API to apply changes to the code. It can be used from a Code Action or from any command (using the applyEdit function).
The current implementation works well for applying local or obvious code transformations. This is often the case with fixes suggested by linters or mechanical code transformations.
As IDEs and related tools become more advanced, they should be able to suggest more complex code transformations. The transformations may come from a human (e.g. during a code review) or a tool. In that case, it is important to let the developer review the change before applying it:
The suggested change is not always correct and can require special attention.
The changes may be complex, modify many locations in a file or in multiple files. The user may accept a subset of the suggested changes.
With our UX team at Google, we have explored solutions to improve the current workflow and give more power to extension developers. As we are using more and more machine learning, we believe it's important to gather additional data (was the suggested change useful?).
Would it be possible to paste in the proposed solutions into this issue as opposed to linking to the deck (which is helpful as well)? Just want to ensure we capture this if/when those resources no longer exist.
Open the diff view when the Refactor Preview is opened (by default, the UX is confusing)
We want a way to select all the changes by default the user should see the changes in the refactor, without having to manually select them all one by one). Unfortunately I expect we need a new API for this (if we want to preserve backward compatibility).
When there are multiple types of changes, have a checkbox in front of the type description (to easily enable/disable the corresponding set of changes)
Have a way to say that some types of changes are mutually exclusive (e.g. a tool provides two solutions for the same problem, and the user can pick only one)
When navigating the changes, the panel should have the focus (so that Space can quickly enable/disable the change I am viewing)
Provide a way for the user to give feedback on a refactoring (e.g. thumb up / thumb down). This is probably too specific; a better solution could be to let the extension developer register their own custom actions.
And a small UX nit.: update the css of the Discard button, it shouldn't be a primary action. Rename Apply to Apply changes (to clarify it will apply all the selected changes).
Apply fixes proposal.pdf
I've converted the deck into a pdf. Some images look quite grainy because they are gifs in the deck - I'll upload those separately
@misolori I've actually been exploring this idea as part of the Code Actions Widget, as well as when I added the refactoring preview (#151140), although it would only apply to refactoring and edit selections from the widget.
At the moment, I'm only looking at Code Actions in particular, which include Quick Fixes, Source Actions, and Refactorings (ie. Extract to inner function with arrow, Surround with Async, Change spelling..., Fix all detected spelling errors, Add all missing imports, etc). When hitting Ctrl + Enter on a selected Code Action, it would open the bulk editor Refactor Preview pane but was also considering opening the Refactor Preview editor (diff view) by default.
(When mouse hovers over)
Not sure if this is a step towards what you're looking for, but might be an interesting thing to also check out!
Activity
albertelo commentedon Aug 2, 2022
Adding David Dossett (@daviddossett) and @misolori who I brought this issue up a month or so ago.
miguelsolorio commentedon Aug 2, 2022
Would it be possible to paste in the proposed solutions into this issue as opposed to linking to the deck (which is helpful as well)? Just want to ensure we capture this if/when those resources no longer exist.
laurentlb commentedon Aug 3, 2022
Here's the list of proposed changes:
Spacecan quickly enable/disable the change I am viewing)And a small UX nit.: update the css of the
Discardbutton, it shouldn't be a primary action. RenameApplytoApply changes(to clarify it will apply all the selected changes).albertelo commentedon Aug 3, 2022
Apply fixes proposal.pdf
I've converted the deck into a pdf. Some images look quite grainy because they are gifs in the deck - I'll upload those separately
justschen commentedon Aug 3, 2022
@misolori I've actually been exploring this idea as part of the Code Actions Widget, as well as when I added the refactoring preview (#151140), although it would only apply to refactoring and edit selections from the widget.
At the moment, I'm only looking at Code Actions in particular, which include Quick Fixes, Source Actions, and Refactorings (ie.
Extract to inner function with arrow,Surround with Async,Change spelling...,Fix all detected spelling errors,Add all missing imports, etc). When hittingCtrl + Enteron a selected Code Action, it would open the bulk editor Refactor Preview pane but was also considering opening the Refactor Preview editor (diff view) by default.(When mouse hovers over)
Not sure if this is a step towards what you're looking for, but might be an interesting thing to also check out!
albertelo commentedon Aug 16, 2022
pinging the thread for updates or if there's something you need from our side that we might have missed in our first messages - thank you!