Skip to content

Commit 148880c

Browse files
martskinsautozimu
authored andcommitted
Add support for rust-anaylzer.selectAndApplySourceChange
1 parent 543a88a commit 148880c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/language_server_protocol.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,23 @@ impl LanguageClient {
847847
}
848848
}
849849
}
850+
"rust-analyzer.selectAndApplySourceChange" => {
851+
if let Some(ref edits) = cmd.arguments {
852+
for edit in edits {
853+
let workspace_edits: Vec<WorkspaceEditWithCursor> =
854+
serde_json::from_value(edit.clone())?;
855+
for edit in workspace_edits {
856+
self.apply_WorkspaceEdit(&edit.workspaceEdit)?;
857+
if let Some(cursorPosition) = edit.cursorPosition {
858+
self.vim()?.cursor(
859+
cursorPosition.position.line + 1,
860+
cursorPosition.position.character + 1,
861+
)?;
862+
}
863+
}
864+
}
865+
}
866+
}
850867
"rust-analyzer.applySourceChange" => {
851868
if let Some(ref edits) = cmd.arguments {
852869
for edit in edits {

0 commit comments

Comments
 (0)