aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index edc3dcfd..f9db5581 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1407,7 +1407,12 @@ fn _goto(
let (view, doc) = editor.current();
let definition_pos = location.range.start;
// TODO: convert inside server
- let new_pos = lsp_pos_to_pos(doc.text(), definition_pos, offset_encoding);
+ let new_pos =
+ if let Some(new_pos) = lsp_pos_to_pos(doc.text(), definition_pos, offset_encoding) {
+ new_pos
+ } else {
+ return;
+ };
doc.set_selection(view.id, Selection::point(new_pos));
align_view(doc, view, Align::Center);
}
@@ -2297,11 +2302,7 @@ pub fn completion(cx: &mut Context) {
let offset_encoding = language_server.offset_encoding();
- let pos = pos_to_lsp_pos(
- doc.text(),
- doc.selection(view.id).cursor(),
- language_server.offset_encoding(),
- );
+ let pos = pos_to_lsp_pos(doc.text(), doc.selection(view.id).cursor(), offset_encoding);
// TODO: handle fails
let future = language_server.completion(doc.identifier(), pos);