diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-29 16:14:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-29 16:14:18 +0000 |
| commit | 386c447038166687b9403bec71d5924b8e2d3fbc (patch) | |
| tree | 8459a76c4a42ed7d6a18cd3e9558d7e21223bd65 /editors/code/src | |
| parent | 343029fa9e52cf4aae7f17ed6e0e6b5b0175a172 (diff) | |
| parent | 689898e4f6588a353e7c0b74a0dede8dda9c917a (diff) | |
| download | rust-386c447038166687b9403bec71d5924b8e2d3fbc.tar.gz rust-386c447038166687b9403bec71d5924b8e2d3fbc.zip | |
Merge #7070
7070: Use applySnippetWorkspaceEdit again for actions, allow it to create files r=matklad a=Veykril Fixes #7037 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Diffstat (limited to 'editors/code/src')
| -rw-r--r-- | editors/code/src/commands.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 9d4823a34de..b12e134ca97 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -469,8 +469,14 @@ export function resolveCodeAction(ctx: Ctx): Cmd { if (!item.edit) { return; } - const edit = client.protocol2CodeConverter.asWorkspaceEdit(item.edit); - await vscode.workspace.applyEdit(edit); + const itemEdit = item.edit; + 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); + await applySnippetWorkspaceEdit(edit); + await vscode.workspace.applyEdit(editWithoutTextEdits); }; } |
