summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 19:36:52 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:03:21 -0300
commit69e809f64a30b09d9bd5ab56a3a80e94fc3f99c3 (patch)
tree24d122a36d501b0f39cf7ff2e2aa412772054c33 /src/ninep/ctl.zig
parent8fe1cbd5ba5792b71f4a1b9be6f3e8df591ec52b (diff)
downloadpardes-69e809f64a30b09d9bd5ab56a3a80e94fc3f99c3.tar.gz
pardes-69e809f64a30b09d9bd5ab56a3a80e94fc3f99c3.zip
split pardes.zig by noun, lsp/Ask: the core's side of a question to the language servers moves into src/lsp/Ask.zig: lspRequest, lspResponse and what an answer does (LspEdit, parseLspEdits, decodePct, mapLspEditOffset, applyLspEdits, lspWord); the session keeps p.lspRequest as a declaration alias (every language word, macOS and the tests call it), lsp.zig names the file (pardes.lsp.Ask, for test/output.zig), and the 9P tests in ninep/ctl.zig call Ask.lspResponse; the wait's fields stay the session's until #38; tests moved with them, by name: Lspwhy after a Hover asks to explain that hover, in its file at its place, run from any pane; Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all run them; Callstack always opens and focuses its own pane, reusing it for another symbol; Callers with one answer jumps to it and says where, in a msg; a Rename the language server finds nothing for says so, and changes nothing; LSP failure clears only its matching wait without completion indentation; a pure move, no field touched, a dump and the wire as they were; gates: tui core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), gui unit-test 1518/1519 (1 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 3393c851..4cb4728f 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -18,6 +18,7 @@ const exec_line = @import("../exec.zig");
const tree = @import("tree.zig");
const pane_files = @import("pane.zig");
const keys = @import("../keys.zig");
+const Ask = @import("../lsp/Ask.zig");
const Pardes = pardes.Pardes;
const Pane = pardes.Pane;
@@ -2118,22 +2119,22 @@ test "a language server question that finds nothing, cannot be answered, or is a
p.fs.late_failure_len = 0;
p.lspRequest(id, .incoming_calls, "");
try testing.expect(p.lsp_wait != null);
- p.lspResponse(p.lsp_wait.?.id, "");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "");
try testing.expectEqualStrings("Callers: callers not found", p.fs.late_failure[0..p.fs.late_failure_len]);
// A backend that cannot answer says why.
p.fs.late_failure_len = 0;
p.lspRequest(id, .outgoing_calls, "");
- p.lspResponse(p.lsp_wait.?.id, "@none zls does not answer call hierarchy\n");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "@none zls does not answer call hierarchy\n");
try testing.expectEqualStrings("Callees: zls does not answer call hierarchy", p.fs.late_failure[0..p.fs.late_failure_len]);
// No answer at all.
p.fs.late_failure_len = 0;
p.lspRequest(id, .hover, "");
- p.lspResponse(p.lsp_wait.?.id, null);
+ Ask.lspResponse(p, p.lsp_wait.?.id, null);
try testing.expectEqualStrings("Hover: the language server did not answer", p.fs.late_failure[0..p.fs.late_failure_len]);
// No diagnostics is no failure.
p.fs.late_failure_len = 0;
p.lspRequest(id, .diagnostics, "");
- p.lspResponse(p.lsp_wait.?.id, "");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "");
try testing.expectEqual(@as(u16, 0), p.fs.late_failure_len);
// An image's body takes no write.
const slot = p.freeSlot().?;
@@ -2802,7 +2803,7 @@ test "a Rename that reaches other files previews them, says so, and is the pane
const id = p.active;
p.fs.lsp_result = null;
p.lspRequest(id, .rename, "sum");
- p.lspResponse(p.lsp_wait.?.id, "lib.rs:2:8 sum\nmain.rs:4:13-15 sum\n");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "lib.rs:2:8 sum\nmain.rs:4:13-15 sum\n");
const preview = p.panes[p.panes[id].?.search_pane.?].?;
try testing.expectEqual(preview.serial, p.fs.lsp_result.?);
try testing.expect(th.logHas(p, "Rename: 2 edit(s) across files, previewed, not applied"));
@@ -2849,7 +2850,7 @@ test "a Rename the server answered for this file alone, with other open files sa
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
p.lspRequest(p.active, .rename, "sum");
- p.lspResponse(p.lsp_wait.?.id, "util.zig:1:8 sum\nmain.zig: also says add, which the server did not rename\n");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "util.zig:1:8 sum\nmain.zig: also says add, which the server did not rename\n");
try testing.expect(th.logHas(p, "Rename: previewed, not applied: the server renamed in this file only, and 1 other open file(s) say the name"));
}
@@ -2889,7 +2890,7 @@ test "Lspinfo's answer is the +Lsp pane it fills, as a Rename preview's is its +
defer p.deinit();
p.fs.lsp_result = null;
p.lspRequest(p.active, .status, "");
- p.lspResponse(p.lsp_wait.?.id, "language servers:\n");
+ Ask.lspResponse(p, p.lsp_wait.?.id, "language servers:\n");
const shown = p.paneBySerial(p.fs.lsp_result.?).?;
try testing.expect(std.mem.endsWith(u8, p.panes[shown].?.file.?.path, "+Lsp"));
}