mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Fix resolveCodeAction trying to edit files before creating them
This commit is contained in:
parent
941f9157f5
commit
fb2b1f5ea6
1 changed files with 3 additions and 3 deletions
|
@ -528,10 +528,10 @@ export function resolveCodeAction(ctx: Ctx): Cmd {
|
||||||
const edit = client.protocol2CodeConverter.asWorkspaceEdit(itemEdit);
|
const edit = client.protocol2CodeConverter.asWorkspaceEdit(itemEdit);
|
||||||
// filter out all text edits and recreate the WorkspaceEdit without them so we can apply
|
// filter out all text edits and recreate the WorkspaceEdit without them so we can apply
|
||||||
// snippet edits on our own
|
// snippet edits on our own
|
||||||
const itemEditWithoutTextEdits = { ...item, documentChanges: itemEdit.documentChanges?.filter(change => "kind" in change) };
|
const lcFileSystemEdit = { ...itemEdit, documentChanges: itemEdit.documentChanges?.filter(change => "kind" in change) };
|
||||||
const editWithoutTextEdits = client.protocol2CodeConverter.asWorkspaceEdit(itemEditWithoutTextEdits);
|
const fileSystemEdit = client.protocol2CodeConverter.asWorkspaceEdit(lcFileSystemEdit);
|
||||||
|
await vscode.workspace.applyEdit(fileSystemEdit);
|
||||||
await applySnippetWorkspaceEdit(edit);
|
await applySnippetWorkspaceEdit(edit);
|
||||||
await vscode.workspace.applyEdit(editWithoutTextEdits);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue