aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-29 16:14:18 +0000
committerGitHub <[email protected]>2020-12-29 16:14:18 +0000
commit386c447038166687b9403bec71d5924b8e2d3fbc (patch)
tree8459a76c4a42ed7d6a18cd3e9558d7e21223bd65 /editors
parent343029fa9e52cf4aae7f17ed6e0e6b5b0175a172 (diff)
parent689898e4f6588a353e7c0b74a0dede8dda9c917a (diff)
Merge #7070
7070: Use applySnippetWorkspaceEdit again for actions, allow it to create files r=matklad a=Veykril Fixes #7037 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 9d4823a34..b12e134ca 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -469,8 +469,14 @@ export function resolveCodeAction(ctx: Ctx): Cmd {
469 if (!item.edit) { 469 if (!item.edit) {
470 return; 470 return;
471 } 471 }
472 const edit = client.protocol2CodeConverter.asWorkspaceEdit(item.edit); 472 const itemEdit = item.edit;
473 await vscode.workspace.applyEdit(edit); 473 const edit = client.protocol2CodeConverter.asWorkspaceEdit(itemEdit);
474 // filter out all text edits and recreate the WorkspaceEdit without them so we can apply
475 // snippet edits on our own
476 const itemEditWithoutTextEdits = { ...item, documentChanges: itemEdit.documentChanges?.filter(change => "kind" in change) };
477 const editWithoutTextEdits = client.protocol2CodeConverter.asWorkspaceEdit(itemEditWithoutTextEdits);
478 await applySnippetWorkspaceEdit(edit);
479 await vscode.workspace.applyEdit(editWithoutTextEdits);
474 }; 480 };
475} 481}
476 482