From 2b90fe66e85791120558d084e651e0d142281b2a Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 8 Aug 2024 23:07:36 +0200 Subject: [PATCH] fix(windows): translate LSP paths back to standard windows paths --- src/Project.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Project.zig b/src/Project.zig index 49c7303..ebc41a1 100644 --- a/src/Project.zig +++ b/src/Project.zig @@ -440,7 +440,12 @@ fn navigate_to_location_link(_: *Self, from: tp.pid_ref, location_link: []const if (!std.mem.eql(u8, targetUri.?[0..7], "file://")) return error.InvalidTargetURI; var file_path_buf: [std.fs.max_path_bytes]u8 = undefined; 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 (builtin.os.tag == .windows) { + if (file_path[0] == '/') file_path = file_path[1..]; + for (file_path, 0..) |c, i| if (c == '/') { + file_path[i] = '\\'; + }; + } if (targetSelectionRange) |sel| { try from.send(.{ "cmd", "navigate", .{ .file = file_path,