summaryrefslogtreecommitdiff
path: root/src/lsp/lsp_client.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 10:19:01 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:36:27 -0300
commit3f76d4d88245e94a266c24dc23bbba78a00570a3 (patch)
tree4ead9b7aa2d0ac38a1a4e27dffb3ead05edce548 /src/lsp/lsp_client.zig
parent4d57197f0135c292750731dd19a6df542378135d (diff)
downloadpardes-3f76d4d88245e94a266c24dc23bbba78a00570a3.tar.gz
pardes-3f76d4d88245e94a266c24dc23bbba78a00570a3.zip
A rename preview's rows are one format whichever file they are in: `file:L:C-E`, the range's end too, for the asked-about file as for the others
The asked-about file's rows said `file:L:C` while other files' said `file:L:C-E`. lsp-rename-files is re-recorded for the one row it shows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/lsp/lsp_client.zig')
-rw-r--r--src/lsp/lsp_client.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig
index ce90b8bb..561195fe 100644
--- a/src/lsp/lsp_client.zig
+++ b/src/lsp/lsp_client.zig
@@ -826,9 +826,11 @@ fn renameEdits(cx: *Cx, enc: Enc, self_uri: []const u8, result: std.json.Value,
const partial = !foreign and also.len > 0;
if (foreign or partial) {
// the preview needs the self-file rows too — the point is the full map
+ // Rows as the other files' are, `file:L:C-E` with the range's end.
for (edits.items) |ed| {
const lc = lsp.lineCol(src, ed.start);
- try lsp.row(cx.out, lsp.rel(cx.base, cx.cur_path), lc.line, lc.col, flat(cx.arena, ed.text));
+ const end = lsp.lineCol(src, ed.end);
+ try lsp.spanRow(cx.out, lsp.rel(cx.base, cx.cur_path), lc.line, lc.col, end.line, end.col, flat(cx.arena, ed.text));
cx.rows += 1;
}
if (partial) for (also) |path| {
@@ -2170,7 +2172,7 @@ test "a rename answered for this file alone, while another open file says the ol
var out: std.Io.Writer = .fixed(&buffer);
var cx: Cx = .{ .arena = arena.allocator(), .base = "/w", .cur_path = "/w/util.zig", .cur_src = "pub fn add() void {}", .out = &out };
try renameEdits(&cx, .utf8, "file:///w/util.zig", parsed.value, cx.cur_src, "add", &.{"/w/main.zig"});
- try std.testing.expectEqualStrings("util.zig:1:8 sum\nmain.zig: also says add, which the server did not rename\n", out.buffered());
+ try std.testing.expectEqualStrings("util.zig:1:8-10 sum\nmain.zig: also says add, which the server did not rename\n", out.buffered());
try std.testing.expectEqualStrings("add", identAt("x = add(1);", 6));
try std.testing.expect(holdsWord("util.add(1)", "add") and !holdsWord("addNumbers", "add"));
}