Skip to content

Commit 8a01347

Browse files
martskinsautozimu
authored andcommitted
Fix WorkspaceEditWithCursor definition
1 parent 34e695d commit 8a01347

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/language_server_protocol.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,10 +841,12 @@ impl LanguageClient {
841841
for edit in edits {
842842
let edit: WorkspaceEditWithCursor = serde_json::from_value(edit.clone())?;
843843
self.apply_WorkspaceEdit(&edit.workspaceEdit)?;
844-
self.vim()?.cursor(
845-
edit.cursorPosition.position.line + 1,
846-
edit.cursorPosition.position.character + 1,
847-
)?;
844+
if let Some(cursorPosition) = edit.cursorPosition {
845+
self.vim()?.cursor(
846+
cursorPosition.position.line + 1,
847+
cursorPosition.position.character + 1,
848+
)?;
849+
}
848850
}
849851
}
850852
}

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,5 +1057,5 @@ pub struct VirtualText {
10571057
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
10581058
pub struct WorkspaceEditWithCursor {
10591059
pub workspaceEdit: WorkspaceEdit,
1060-
pub cursorPosition: TextDocumentPositionParams,
1060+
pub cursorPosition: Option<TextDocumentPositionParams>,
10611061
}

0 commit comments

Comments
 (0)