aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Kuthe2023-04-21 03:50:37 +0000
committerGitHub2023-04-21 03:50:37 +0000
commitc3e2db77f7d1d268856e0c3cba328e9fbd0cc71f (patch)
treeb0492bc906ae10b2a1100f48156b4b41e362aa61
parent13cc44c65e5037141b52f4a1b5fc66d7db100d25 (diff)
flip symbol range in LSP goto commands (#6794)
-rw-r--r--helix-term/src/commands/lsp.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 7a26b3cf..be8ae02a 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -205,7 +205,9 @@ fn jump_to_location(
log::warn!("lsp position out of bounds - {:?}", location.range);
return;
};
- doc.set_selection(view.id, Selection::single(new_range.anchor, new_range.head));
+ // we flip the range so that the cursor sits on the start of the symbol
+ // (for example start of the function).
+ doc.set_selection(view.id, Selection::single(new_range.head, new_range.anchor));
align_view(doc, view, Align::Center);
}