summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 20:41:32 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:07:55 -0300
commit4c3dbce20f11204f6d4bfb715239beae74259e7f (patch)
tree7cc261bdf39843b347b1b1c27829795b2e216774 /src/ninep
parent50914b0e04ac0129b11bff0f0007d5cedbfc7f8d (diff)
downloadpardes-4c3dbce20f11204f6d4bfb715239beae74259e7f.tar.gz
pardes-4c3dbce20f11204f6d4bfb715239beae74259e7f.zip
fields #38, the jump list, the language servers' question and the core's clock are fields of their nouns: Jump.zig is the jump list's type (list, n, cur, force, its own len annotation) and the session's jumps a Jump where it was jumps, njumps, jcur and jump_force; lsp/Ask.zig is the question's (seq, last, wait) and the session's lsp_ask an Ask where it was lsp_seq, lsp_last and lsp_wait; the clock is the session's clock, a Clock (now_ns, stepped_ns, started) where it was now_ns, stepped_ns and clock_started; a view opened still starts with no query's mark on its jumps and one closed leaves the staying view's (views.zig), as when the mark was a field of its own; callers in 26 files read p.jumps.n, p.lsp_ask.wait, p.clock.now_ns (macos.zig's lsp_wait tests by text, built nowhere here; dump.zig, the persistence agent's, only where it names lsp_seq); a dump written before this change loads these as their defaults once: an Upgrade or Restore from it comes back with no jumps, no language question awaited and its clock unstarted (jumps' kind changed, so the decoder says so), and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; 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')
-rw-r--r--src/ninep/ctl.zig16
-rw-r--r--src/ninep/pane.zig6
2 files changed, 11 insertions, 11 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index dc95e0ec..04ac1cbf 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2118,23 +2118,23 @@ test "a language server question that finds nothing, cannot be answered, or is a
// Nothing found: Callers says so, and the waiting write hears it.
p.fs.late_failure_len = 0;
p.lspRequest(id, .incoming_calls, "");
- try testing.expect(p.lsp_wait != null);
- Ask.lspResponse(p, p.lsp_wait.?.id, "");
+ try testing.expect(p.lsp_ask.wait != null);
+ Ask.lspResponse(p, p.lsp_ask.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, "");
- Ask.lspResponse(p, p.lsp_wait.?.id, "@none zls does not answer call hierarchy\n");
+ Ask.lspResponse(p, p.lsp_ask.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, "");
- Ask.lspResponse(p, p.lsp_wait.?.id, null);
+ Ask.lspResponse(p, p.lsp_ask.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, "");
- Ask.lspResponse(p, p.lsp_wait.?.id, "");
+ Ask.lspResponse(p, p.lsp_ask.wait.?.id, "");
try testing.expectEqual(@as(u16, 0), p.fs.late_failure_len);
// An image's body takes no write.
const slot = p.freeSlot().?;
@@ -2803,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");
- Ask.lspResponse(p, p.lsp_wait.?.id, "lib.rs:2:8 sum\nmain.rs:4:13-15 sum\n");
+ Ask.lspResponse(p, p.lsp_ask.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"));
@@ -2850,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");
- Ask.lspResponse(p, 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_ask.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"));
}
@@ -2890,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, "");
- Ask.lspResponse(p, p.lsp_wait.?.id, "language servers:\n");
+ Ask.lspResponse(p, p.lsp_ask.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"));
}
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index ab4b2d7d..4595d02d 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -564,7 +564,7 @@ pub const batch_pause_ns: u64 = 20 * std.time.ns_per_ms;
pub fn flushPausedBatch(p: *Pardes) void {
const b = &p.fs.batch;
if (b.bytes.items.len == 0) return;
- if (p.now_ns != 0 and p.now_ns -| b.last_ns < batch_pause_ns) return;
+ if (p.clock.now_ns != 0 and p.clock.now_ns -| b.last_ns < batch_pause_ns) return;
flushBatch(p);
}
@@ -606,7 +606,7 @@ fn holdWrite(p: *Pardes, req: Req, pane: *Pane, at: usize) error{OutOfMemory}!?u
if (b.bytes.items.len == 0) b.* = .{ .serial = pane.serial, .node = req.node, .handle = req.handle, .at = at, .bytes = b.bytes };
const take = wholeUtf8(req.data);
try b.bytes.appendSlice(p.gpa, req.data[0..take]);
- b.last_ns = p.now_ns;
+ b.last_ns = p.clock.now_ns;
return take;
}
@@ -1083,7 +1083,7 @@ test "writes held before the shell's clock is first seen go in at its first step
const p = try withFile(testing.allocator, "one\n");
defer p.deinit();
const body = Node.of(serialOf(p), .body);
- try testing.expect(!p.clock_started);
+ try testing.expect(!p.clock.started);
const h = call(p, .{ .tag = 1, .op = .open, .node = body, .omode = 1 }).reply.handle;
const revision = p.panes[0].?.file.?.revision;
_ = call(p, .{ .tag = 2, .op = .write, .node = body, .handle = h, .data = "x\n" });