Skip to content

Workspace edit metadata needsConfirmation results in all checkboxes unchecked #200991

Closed as not planned

Description

@BoykoAlex

The WorkspaceEdit that has metadata with needsConfirmation set to true shows the Refactor Preview which is great but all checkboxes are unchecked. I'd rather have all checkboxes checked.

I went through various git issues where showing Refactor View was first implemented. All screenshots show all changes check-marked. I also saw this one #144893 which also shows all changes check-marked and the request to check/uncheck a group of changes which would be useful.

However, I always have all changes unchecked and wonder how they could be all checked by default?
I'd appreciate a code snippet

For example i have this:

            const edit: VSCode.WorkspaceEdit = new VSCode.WorkspaceEdit();
    
            const folders = VSCode.workspace.workspaceFolders;
            if (!folders || folders.length === 0) {
                VSCode.window.showInformationMessage('Open a folder first');
                return;
            }
            const newFile = VSCode.Uri.joinPath(folders[0].uri, 'foo.txt');
            edit.createFile(newFile, 
                { overwrite: true }, 
                { label: 'New text', needsConfirmation: true }
            );
    
            const initialContent = new TextEdit(new Range(new Position(0,0), new Position(0, 0)), "Hello World\nOne more line");
            edit.set(newFile, [initialContent]);
    
            VSCode.workspace.applyEdit(edit, { isRefactoring: true });

How can i make checkboxes checked for the above?

Activity

  1. Raf-A2F commented on Dec 18, 2023

    @Raf-A2F
  2. DanTup commented on Apr 11, 2024

    @DanTup
    Contributor

    Maybe same as #207578?

  3. added
    *as-designed
    on Dec 11, 2024
  4. vs-code-engineering commented on Dec 11, 2024

    @vs-code-engineering
    Contributor

    The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.

    Happy Coding!

  5. jrieken commented on Dec 11, 2024

    @jrieken
    Contributor

    This is actually designed. Needs confirmation means the extension is unsure about this change and the user must explicitly accept it

  6. locked and limited conversation to collaborators on Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*as-designeduxworkspace-edit

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions