fix: prefer targetSelectionRange over targeRange if both are provided by LSP

This prevents rust-analyser sending goto_definition to the very beginning of the
definition, including doc comments and attributes.

closes #261
This commit is contained in:
CJ van den Berg 2025-05-15 11:40:10 +02:00
parent cb399a4c73
commit 1eb36696d2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -758,8 +758,8 @@ fn navigate_to_location_link(from: tp.pid_ref, location_link: []const u8) (Clien
from.send(.{ "cmd", "navigate", .{
.file = file_path,
.goto = .{
targetRange.?.start.line + 1,
targetRange.?.start.character + 1,
targetSelectionRange.?.start.line + 1,
targetSelectionRange.?.start.character + 1,
sel.start.line,
sel.start.character,
sel.end.line,