From ee84ce8b7f14d5cb5f2394a70409335339948fd2 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Mon, 17 Apr 2023 23:26:51 +0200 Subject: [PATCH] flip symbol range in LSP goto commands --- helix-term/src/commands/lsp.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 7a26b3cf6024..be8ae02a630a 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); }