summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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"));
}