From 5eeeb837ad3c8d6d7e973adece31f2562e5a8c4e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 8 Aug 2024 22:26:37 +0200 Subject: [PATCH] fix(windows): remove leading slash from LSP URIs on windows --- src/Project.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Project.zig b/src/Project.zig index 7f1a6c4..49c7303 100644 --- a/src/Project.zig +++ b/src/Project.zig @@ -439,7 +439,8 @@ fn navigate_to_location_link(_: *Self, from: tp.pid_ref, location_link: []const if (targetUri == null or targetRange == null) return error.InvalidMessageField; if (!std.mem.eql(u8, targetUri.?[0..7], "file://")) return error.InvalidTargetURI; var file_path_buf: [std.fs.max_path_bytes]u8 = undefined; - const file_path = std.Uri.percentDecodeBackwards(&file_path_buf, targetUri.?[7..]); + var file_path = std.Uri.percentDecodeBackwards(&file_path_buf, targetUri.?[7..]); + if (builtin.os.tag == .windows and file_path[0] == '/') file_path = file_path[1..]; if (targetSelectionRange) |sel| { try from.send(.{ "cmd", "navigate", .{ .file = file_path,