Skip to content

Support controlling whether edits are pre-ticked in WorkspaceEdits with needsConfirmation=true #207578

Description

@DanTup

It's sometimes useful to force the user to review a preview of refactor changes before applying. This can be done with needsConfirmation:

const edit = new vscode.WorkspaceEdit();
const doc = await vscode.workspace.openTextDocument({ language: "text", content: "" });
edit.insert(doc.uri, new vscode.Position(0, 0), "This is inserted text", {
	label: "Insert imports",
	needsConfirmation: true, // Show preview, but also requires ticking
});
edit.insert(doc.uri, new vscode.Position(0, 0), "This is inserted text", {
	label: "Update code",
	needsConfirmation: true, // Show preview, but also requires ticking
});
vscode.workspace.applyEdit(edit);

image

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityuxUser experience issuesworkspace-edit

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions