From 5ebf44631b7f4eb6611c1295e40869104c29b5d5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 19:50:07 -0300 Subject: A Rename the language server finds nothing for says so, "Rename: nothing here to rename", and fails the write that asked it An empty answer to a rename returned without a word, so Rename on a place with no symbol looked like a rename that worked. It is now the not-found failure every other query gives. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pardes.zig b/src/pardes.zig index 6a78c115..c8fffd80 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -6656,7 +6656,7 @@ pub const Pardes = struct { // fall through: a multi-file rename previews as rows } else if (w.kind == .format and rows.len > 0) { // fall through: "cannot format" and friends are prose - } else return; + } else if (w.kind == .format) return; // a rename of nothing says so, below } if (rows.len == 0) { if (w.kind == .completion and pane.body.mode == .insert and pane.body.nsel == 0 and @@ -6664,7 +6664,8 @@ pub const Pardes = struct { // Nothing found fails, but for a file with no diagnostics, // which is no failure, and a completion's Tab. const none: ?[]const u8 = switch (w.kind) { - .completion, .format, .rename => null, + .completion, .format => null, + .rename => "nothing here to rename", .diagnostics, .workspace_diagnostics => return p.setMessage(w.pane, std.fmt.bufPrint(&said, "{s}: none", .{lspWord(w.kind)}) catch "none"), .incoming_calls => "callers not found", .outgoing_calls => "callees not found", @@ -8060,6 +8061,18 @@ test "the jump list never holds two entries in a row the same, when the one betw try std.testing.expectEqual(@as(u32, 150), p.jumps[1].line); } +test "a Rename the language server finds nothing for says so, and changes nothing" { + if (!lsp.supports.contains(.rename)) return; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + const pane = try p.setTestFile("const value=1;\n"); + p.lspRequest(p.active, .rename, "renamed"); + const wait = p.lsp_wait.?; + p.update(.{ .lsp_resp = .{ .id = wait.id, .rows = "" } }); + try std.testing.expectEqualStrings("Rename: nothing here to rename", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("const value=1;\n", pane.file.?.content); +} + test "hopping between two panes does not grow the jump stack" { if (platform == .web) return; const gpa = std.testing.allocator; -- cgit v1.3