From fb2b1f5ea606edb1b868a133818ce36069360fed Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 5 Feb 2021 21:26:14 +0100 Subject: Fix resolveCodeAction trying to edit files before creating them --- editors/code/src/commands.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index c1c9f9754..cbda619ea 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -528,10 +528,10 @@ export function resolveCodeAction(ctx: Ctx): Cmd { const edit = client.protocol2CodeConverter.asWorkspaceEdit(itemEdit); // filter out all text edits and recreate the WorkspaceEdit without them so we can apply // snippet edits on our own - const itemEditWithoutTextEdits = { ...item, documentChanges: itemEdit.documentChanges?.filter(change => "kind" in change) }; - const editWithoutTextEdits = client.protocol2CodeConverter.asWorkspaceEdit(itemEditWithoutTextEdits); + const lcFileSystemEdit = { ...itemEdit, documentChanges: itemEdit.documentChanges?.filter(change => "kind" in change) }; + const fileSystemEdit = client.protocol2CodeConverter.asWorkspaceEdit(lcFileSystemEdit); + await vscode.workspace.applyEdit(fileSystemEdit); await applySnippetWorkspaceEdit(edit); - await vscode.workspace.applyEdit(editWithoutTextEdits); }; } -- cgit v1.2.3