From 689898e4f6588a353e7c0b74a0dede8dda9c917a Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 29 Dec 2020 15:43:17 +0100 Subject: Apply text edits manually in vscode client --- editors/code/src/commands.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'editors/code/src') 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 { 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); }; } -- cgit v1.2.3