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
Support controlling whether edits are pre-ticked in WorkspaceEdits with needsConfirmation=true #207578
It's sometimes useful to force the user to review a preview of refactor changes before applying. This can be done with needsConfirmation:
constedit=newvscode.WorkspaceEdit();constdoc=awaitvscode.workspace.openTextDocument({language: "text",content: ""});edit.insert(doc.uri,newvscode.Position(0,0),"This is inserted text",{label: "Insert imports",needsConfirmation: true,// Show preview, but also requires ticking});edit.insert(doc.uri,newvscode.Position(0,0),"This is inserted text",{label: "Update code",needsConfirmation: true,// Show preview, but also requires ticking});vscode.workspace.applyEdit(edit);
However, the user needs to tick each change (at least the unique labels, which have a "Toggle Change" option on the context menu) which can be a pain if the edit is making a lot of changes that are grouped (for example fixing lint failures across a workspace, with each lint being a group).
It would be a much nicer experience if we could trigger the preview, but with everything ticked by default. In many cases we know the user is likely to apply all of the changes, but we still want to trigger a preview to be shown.
Reacted by Danny Tuppeny, Daniel Chevalier, Abitofevrything, Remi Rousselet, osama, lyngai, Konstantin Scheglov, Navaron Bracke, Brian Wilkerson, Sam Rawlins and 63 more
It is a good suggestion, and we have the same thoughts of feedback. Or, is it possible vscode can add a button by default, saying select all/unselect all
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
For example an additional flag needsPreview that triggers the preview without being unticked?
Refactor previews that don't use commands are all ticked by default, so not being able to do it here leads to inconsistent refactors depending on whether they are CodeActions or triggered from commands.
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Activity
jasonwang82 commentedon Apr 7, 2024
It is a good suggestion, and we have the same thoughts of feedback. Or, is it possible vscode can add a button by default, saying select all/unselect all
vscodenpa commentedon Apr 8, 2024
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
DanTup commentedon Apr 10, 2024
Johannes Rieken (@jrieken) would you accept a PR to add something here?
For example an additional flag
needsPreviewthat triggers the preview without being unticked?Refactor previews that don't use commands are all ticked by default, so not being able to do it here leads to inconsistent refactors depending on whether they are
CodeActions or triggered from commands.vscodenpa commentedon Apr 11, 2024
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
DanTup commentedon Apr 11, 2024
Started on a PR at #210175, feedback appreciated!