summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 19:50:07 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit5ebf44631b7f4eb6611c1295e40869104c29b5d5 (patch)
treee95d9a6d2aee198eb4c8ab7a97f7a636722816a9 /src
parentd5c6563c95b942f1d2dade817e11ae38fc99e880 (diff)
downloadpardes-5ebf44631b7f4eb6611c1295e40869104c29b5d5.tar.gz
pardes-5ebf44631b7f4eb6611c1295e40869104c29b5d5.zip
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/pardes.zig17
1 files changed, 15 insertions, 2 deletions
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;