From 1eb36696d24e4c570448a5a2491ad486705aa665 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 15 May 2025 11:40:10 +0200 Subject: [PATCH] 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 --- src/Project.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Project.zig b/src/Project.zig index 80a4fd6..60ed0e9 100644 --- a/src/Project.zig +++ b/src/Project.zig @@ -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,