From 680cfe1fa5a15be3770d310153258ba9ded13dd8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 02:35:56 -0300 Subject: dev, runtime: the language servers' client once, through the session's one queue: both frontends start a query with Inbox.startLsp (its task and its id in the Inbox, an older answer turned away at the push and an older one still queued discarded) and land an answer or a status line with Inbox.landLsp; the session loop sets the language client's status sink on its queue from before the first effects and unsets it before the queue goes, a Restore turns the old core's answer away (discardCompletions, the window's way) and the queue's end cancels the query in flight; the terminal's own copy is deleted (its lsp_task, deliverLspRows posting lsp_done to vaxis's queue, a post that BLOCKED the language worker while that queue was full, lspStatusSink, the lsp_done and lsp_status messages and arms, the cancels in close and restoring) and with it its test of a stale answer at apply (the Inbox's rejection is pinned by gui.zig's worker-setup test); what a user sees: a window now shows an LSP status said during the session's first effects (its sink was set only after them), nothing else; the loop's frontend calls stay nine (close and restoring shrank); tui core-test 857/1007 (150 skipped), shell-test 1046/1049 (-1, the deleted test), term 17/17, pane 183/184, kitty 45/45, behaviour-test and --replay 275/275, process-test 0 of 144 failed (hscroll once in the run, passed on its retry), soaks --clients 5 and --bytes --clients 5 diverged 0, unequal 0, quiet checks 651/0 673/0 779/0 and 920/0 723/0 755/0, unlisted 0, corpus scene 22 of 22, no leak; gui unit-test 1643/1647 with only the perf check's BaselineHarnessMismatch; daemon.py plain, --far, --games, --window-clients, --upgrade both ways pass (load 11-16) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- dev/gui/gui.zig | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'dev/gui/gui.zig') diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 59e0516a..df3d2f2b 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1047,11 +1047,9 @@ const Own = struct { const io = l.io; o.shell.fs = null; host_io.setExitWake(null, null); - pardes.lsp.setStatusSink(null, null); pardes.Kind.drawer = null; o.shell.job_tasks.cancelAll(io); o.pipe_tasks.cancelAll(io); - if (l.inbox.lsp_task) |*task| task.future.cancel(io); // Its worker may be waiting on the queue for room. l.core.stream.cancelTask(); o.g.hit_core = null; @@ -1066,7 +1064,6 @@ const Own = struct { if (o.test_mode) setStdinRaw() catch {}; o.shell.threads_ok = true; - pardes.lsp.setStatusSink(&l.inbox, Queue.lspStatus); host_io.setExitWake(&l.inbox, Queue.wakeForExit); if (o.detached) { o.shell.closeTheWindow(); @@ -1087,7 +1084,6 @@ const Own = struct { pub fn restoring(o: *Own, nc: *pardes.Pardes) void { o.pipe_tasks.cancelAll(o.shell.io); - o.shell.queue.discardCompletions(); // One view, the window's (host_io.restoreCore). o.shell.gview = 0; o.g.cells.clearImages(); @@ -2601,15 +2597,7 @@ const Shell = struct { for (msgs.slice()) |m| switch (m) { .output => |o| s.ptys.output(s.core, o), .eof => |e| s.ptys.eof(s.core, e), - .lsp => |l| { - s.core.update(.{ .lsp_resp = .{ .id = l.id, .rows = l.rows } }); - if (l.rows) |rows| s.lsp_allocator.free(rows); - }, - .lsp_status => |text| { - var mbuf: [256]u8 = undefined; - s.core.setStatus(.at(s.core.view().active), message.stamp(&mbuf, "lsp", text)); - s.lsp_allocator.free(text); - }, + .lsp, .lsp_status => s.queue.landLsp(s.core, m), .pipe => |response_value| { var response = response_value; s.core.update(.{ .pipe_resp = .{ -- cgit v1.3