Skip to content

Workspace edit metadata needsConfirmation results in all checkboxes unchecked #200991

@BoykoAlex

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions