From 02b64ff90ae2f82fb83a604f6d4ded3459a84620 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 26 Nov 2026 04:54:39 -0300 Subject: Lsp, lsp_client, File, dump: a file of a language a server speaks, opened in a pane (a Look, a landing, a walk step, the boot's file, a restored session's), starts that server and tells it of the file on a worker of its own, so the file's first question finds it ready (agent V4's find for the comparison video, VIDEO2/STORY.md §4.1 and §10.2: pardes's first `gd` cost about 2.5 s where Helix's, LazyVim's and Doom's cost 0.05 s; the user was asked, the default yes); THE CAUSE: dev/lsp/lsp_client.zig spawned a server on the first query that needed it (its header's lifecycle), and that query paid the spawn, the handshake and the server's first parse of the file; THE FIX: an effect `lsp_open`, emitted beside the file's watch by File.open (look.open, Trail's step, the boot document) and dump.revivePane (a restored or upgraded session), performed through a Host entry `lsp_open` (tui, gui and macOS: Inbox.openLsp; not held for `threads_ok`: the boot's file and a restored session's are opened before the loop's threads start); dev/Lsp.zig `open` asks nothing for a file no spec speaks for (lsp.speaks, on the loop), else copies the pane's file (`snapshot`) and hands it to a worker of its own (`Opener`, one at a time: a file opened while one is under way is let go and told at its first query, syncDoc; one done is awaited, at once, before the next), which calls lsp_client.open: a spec disabled asks nothing, a binary not found disables the spec without a word (its first query says `language server for .py not found`, not every file opened), else `ensure` (the server started as a query starts it, `starting` and `ready` narrated as before, one per spec) and `syncDoc` (didOpen); nothing in the query log; not through Lsp.start (its cancel and join of the query in flight waits out a protected handshake, up to init_ms = 8 s, on the loop) nor `work` (the queries' one fixed region, memory.takeLspQuery); a picker's preview (Pick.preview, no pane) and a 9P `ctl get` (ninep/ctl.zig getFile, no File.open) start none; Lspinfo says `not started yet (a file of its opened starts it)`; docs/typ/setup.typ and reference.typ say when a server starts; THE HARNESSES (the coordinator's ruling: no test starts a server of this machine's): PARDES_LSP_OPEN=off starts none and is the process harnesses' default (test/process.zig's child environment, test/tty.zig, and test/fs.py, selfmount.py and daemon.py's base_env), so the `lsp` tty cases' zls is started by their first query as before; a test binary (builtin.is_test) starts none unless it says `on`, as the behaviour harness's language sessions do (Session.initLanguage, every spec the mock or off, `.lsp_open` drained as a host performs it, awaited); RUN (TEST FIRST): behaviour/language_servers.zig "a file of a server's language opened in a pane starts that server and tells it of the file, with no query asked; a picker's preview of one starts none, a second file no second server, and a server not installed is found silently" previews a.zig in Find's picker (Lspinfo: zls `not started yet`), opens it (zls `ready`, `docs 1`, the query count unchanged), opens b.zig (`docs 2`: the same server), and opens c.py and d.py with PARDES_LSP_PY naming no binary (pyright `disabled`, no query, nothing on the screen): fails on the base at language_servers.zig:367 (zls not started by the open), passes now; lsp_client.zig "a file opened whose server is not installed disables it without a word ..." opens two .py files with a status sink set: the spec disabled, no word posted, a query then `not found`; MEASURED (.scratch/walkui/T23/measure-v8.sh: VIDEO's probe.py, the screen polled every 50 ms, this change's Debug tui, a reflink copy of VIDEO2's V8 tree with clangd and its 27-file compile database, torque-parser.cc opened, `743ggfI` then `gd` 4 s after the start, until utils.h's `bool IsUpperCamelCase` shows): with PARDES_LSP_OPEN=off (the base's way) 1.97, 1.98, 1.97 s; started at the open 0.05, 0.05, 0.05 s; on VIDEO's tally with zls (measure.sh) both ways 0.05-0.10 s (zls starts and answers within one poll there); a user hit it on the first question of every file of a session's languages, about 2 s with clangd over a real project; NEW HOT PATHS: none per key or frame; per file opened, one effect more and on the loop lsp.speaks (the spec table's extensions); for a file a spec speaks for, a copy of its text (the snapshot a query makes) and a worker started; GATES: core-test 1130/1304 (174 skipped: +1), shell-test 1352/1355 (3 skipped: +1), pane-test 183/184, behaviour-test 286/286 (+1) and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 147 failed (3 skipped), term-test 17/17, kitty-test 45/45; the wire's semantics move (a Host entry, tape.shape); no dump change (effects are local, not dumped); the soak `replicas -- --clients 5 --rtt 30,80,207` dies on the base too (5dab435d7262, run here: `allocator leaks detected` at seed 0 rtt 80, MuPDF's allocations of documents a picker previewed, Pick.showKind), so run without the pdf addon (its binary, `--addon` image and life): diverged 0, unequal 0, quiet checks 468/0 251/0 657/0, stops not on may_wait 0, the corpus 22 of 22 scenes the same, no leak (a first run had one key stop at `spawn` at seed 3 rtt 80, exec.zig's rerun of a command pane, which emits a spawn with no `open a terminal` stop; the base's run and a second run had none); the gui unit-test run once, on T3's change over this one (its description); no frame or perf gate (the user's rule of 2026-11-26); load 1.1 to 9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- docs/typ/reference.typ | 2 +- docs/typ/setup.typ | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'docs/typ') diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 42b44fc9..a08d3acc 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -295,7 +295,7 @@ A line written to #file("exec") is #word("Exec"): index the file asks (`scip: , , , , indexed , files newer`, or `scip: no index.scip above ; Index runs `), which server serves it and its state (`not - started yet` until its first query starts it, ` failed recently; + started yet` until a file of its opened starts it, ` failed recently; retry in Ns` while it backs off), and what answered each query lately (`scip`, or the server); #word("Lspwhy") narrates the last query step by step (in `+Lsp`). The diff --git a/docs/typ/setup.typ b/docs/typ/setup.typ index c9556c61..3ef67da5 100644 --- a/docs/typ/setup.typ +++ b/docs/typ/setup.typ @@ -119,8 +119,10 @@ script on that `PATH` is a word you can click. = Language servers -pardes starts a language server for a file it knows, searching `PATH` first -and then `~/.local/bin` (desktop launchers may leave it out of `PATH`): +pardes starts a language server when a file it knows opens in a pane (a +picker's preview starts none), searching `PATH` first and then +`~/.local/bin` (desktop launchers may leave it out of `PATH`), so the +file's first question finds it ready: #pairs( [`.zig`], [`zls` (`PARDES_LSP_ZIG`)], -- cgit v1.3