mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Apply text edits manually in vscode client
This commit is contained in:
parent
77ad203a71
commit
689898e4f6
1 changed files with 8 additions and 2 deletions
|
@ -469,8 +469,14 @@ export function resolveCodeAction(ctx: Ctx): Cmd {
|
||||||
if (!item.edit) {
|
if (!item.edit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const edit = client.protocol2CodeConverter.asWorkspaceEdit(item.edit);
|
const itemEdit = item.edit;
|
||||||
await vscode.workspace.applyEdit(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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue