summaryrefslogtreecommitdiff
path: root/src/lsp/lsp_client.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 06:22:44 -0300
committerGabriel Schneider <[email protected]>2026-10-01 07:16:43 -0300
commit85b60dedb6bdb192abd11b2d58ca7c0e8c944b18 (patch)
tree13bc6a9f1f1551088c992a29cb365f5d0a63b239 /src/lsp/lsp_client.zig
parentfb330ce04c4eec4de317637d26310b74e2ee5923 (diff)
downloadpardes-85b60dedb6bdb192abd11b2d58ca7c0e8c944b18.tar.gz
pardes-85b60dedb6bdb192abd11b2d58ca7c0e8c944b18.zip
A Rename, references and the like tell the server of every open file of its language first, so a rename reaches files it had not seen and the preview lists them
zls renames only in the documents in its store, and syncDoc told it of a file only when a query was asked from it, so renaming in progress.zig left main.zig unchanged and broken, with no preview. For a query whose answer can reach other files (rename, references, implementation, workspace symbols, calls and type hierarchy), the host snapshots every other open file and the client syncs those its server answers for first. The mock server answers a rename in each document it was told of; lsp-rename-files opens main.rs by a look, renames from lib.rs, and its preview lists both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/lsp/lsp_client.zig')
-rw-r--r--src/lsp/lsp_client.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig
index 0c5e3b7e..b57b348e 100644
--- a/src/lsp/lsp_client.zig
+++ b/src/lsp/lsp_client.zig
@@ -501,6 +501,14 @@ fn run(c: *Conn, si: usize, arena: std.mem.Allocator, req: lsp.Req, out: *std.Io
var uri: std.ArrayList(u8) = .empty;
try uriOf(&uri, arena, req.path);
try syncDoc(c, si, arena, uri.items, req.source);
+ // Every other open file this server answers for, before a query whose
+ // answer reaches them: zls renames only in the documents it has.
+ for (req.others) |doc| if (specFor(doc.path) == si and !std.mem.eql(u8, doc.path, req.path)) {
+ var other: std.ArrayList(u8) = .empty;
+ try uriOf(&other, arena, doc.path);
+ try syncDoc(c, si, arena, other.items, doc.source);
+ tr.note("synced {s} first", .{std.fs.path.basename(doc.path)});
+ };
const pos = posOf(req.source, req.offset, c.caps.enc);
var cx: Cx = .{ .arena = arena, .base = req.root, .cur_path = req.path, .cur_src = req.source, .out = out };