From 7e8e2655567cab1c28597f44d0aec79e46b0deb8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 22:31:27 -0300 Subject: Zig files go to zls as a child process through the protocol client, as every other language does: the in-process ZLS backend goes lsp_zls.zig (1,522 lines), the zls dependency, build.zig's zls wiring and the import graph it baked into the options only for it, and main.zig's reference go. lsp_client's table gains a zls row (PARDES_LSP_ZIG overrides it); Hover, Rename, Diagnostics, WsSymbols, Lspinfo and gd answer through it (checked with lspprobe and the snapshots against zls 0.16.1-dev). What changes for a user: zls must be on PATH; a completion's rows are zls's candidates at the cursor, where the linked analyser gave each one's declaration; document symbols carry no signature. The Zig snapshots (lsp, lspcomplete, lspcompletemoved, lspdebug, lsprelpath) run the real zls now: lspdebug reads the client's explain and report, lsprelpath spells gr's rows where it spelled a completion's, and their goldens are recorded again (stable over three runs). Lspinfo still opens with its backend line. The ReleaseFast tty binary is 105.35 MB to 96.28 MB, the Debug one 296.5 MB to 245.9 MB. docs/lsp.md, web.md, design.typ and the README say so. Co-Authored-By: Claude Opus 5.5 --- docs/design.typ | 4 ++-- docs/lsp.md | 19 ++++++++++--------- docs/web.md | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/design.typ b/docs/design.typ index ec9bd5c4..80c8bb49 100644 --- a/docs/design.typ +++ b/docs/design.typ @@ -1989,8 +1989,8 @@ rules as Look. Tutor: embedded text as file pane. *Language.* The native host snapshots each request and runs it outside the UI -loop. Zig uses the in-process ZLS backend; configured external language servers -use the JSON-RPC client. Results become output rows or edits, applied only while +loop. Every language's server, Zig's zls included, is a child process the +JSON-RPC client speaks to. Results become output rows or edits, applied only while the request's pane and revision still match. Web and board builds have no language backend. See `docs/lsp.md` for configuration and commands. diff --git a/docs/lsp.md b/docs/lsp.md index 82586344..ae350156 100644 --- a/docs/lsp.md +++ b/docs/lsp.md @@ -1,8 +1,9 @@ # Language intelligence Native hosts, including detached sessions, run language queries on workers. -Zig uses the linked ZLS analyser; other languages use the protocol client in -`src/lsp/lsp_client.zig`. Web and board builds have no language backend. +Every language, Zig included, goes through the protocol client in +`src/lsp/lsp_client.zig`, which runs its server as a child process: Zig's is +`zls`, which must be on PATH. Web and board builds have no language backend. `Lspinfo` (`SPC l i`) reports backend versions, server state, capabilities, recent timings and errors. `Lspwhy` (`SPC l w`) traces resolution at the cursor. @@ -37,14 +38,13 @@ without starting a query. Formatting and same-file rename apply as one undo transaction. A workspace rename spanning other files opens a preview; it does not partially apply the -rename. The linked Zig analyser resolves current-file references and relative -imports, but does not run the build runner to discover dependency modules. +rename. ## Configuration and testing -`PARDES_LSP_RS`, `_C`, `_GO`, `_TS` and `_PY` override the server executable -for each language. An empty value disables that server. `ZIG_LIB_DIR` overrides -the stdlib path recorded at build time. `Lspinfo` shows the effective settings. +`PARDES_LSP_ZIG`, `_RS`, `_C`, `_GO`, `_TS` and `_PY` override the server +executable for each language. An empty value disables that server. `Lspinfo` +shows the effective settings. The protocol client keeps one child server per configured language, negotiates position encoding, and handles both push and pull diagnostics. Startup and @@ -52,8 +52,9 @@ request waits have deadlines; failed starts back off before retrying. Worker status messages reach the host event queue. `zig build lspprobe -- gd :` queries the same backend from -the command line. `zig build lspbench` measures it. Snapshot tests use a Zig -mock server with deterministic answers while exercising the real client, +the command line. `zig build lspbench` measures it. The Zig snapshot tests +(lsp, lspcomplete, lspdebug and the rest) run the real `zls`; the protocol +ones use a Zig mock server with deterministic answers while exercising the real client, including process startup, framing, edits and undo. `zig build fs-test` also checks language-worker delivery in TTY and detached sessions over 9P. diff --git a/docs/web.md b/docs/web.md index bbbed8a3..0a9783c9 100644 --- a/docs/web.md +++ b/docs/web.md @@ -80,7 +80,7 @@ What is genuinely absent is narrower than "no IO". The module has no threads and no host filesystem, so there is no startup config directory, init file, ThemeFile, or DumpThemes; LOOK resolves against the build-generated source archive rather than disk, and no language -BACKEND is compiled in (`zls_backend` is off for wasm — which also means +BACKEND is compiled in (there is none for wasm — which also means `lsp.supports` is empty, so the core never even raises a language query there, and the host leaves `lsp` null). @@ -114,7 +114,7 @@ land in the per-instance fallback, so a pane with no child is SILENT rather than synthetic; `tty_taken` is never taken; any save the page declines resolves against the core's virtual filesystem, which is also where every read comes from — the core reads files itself and never asks a host; `watch_file` records -the request; `lsp` answers an empty row set at once (`zls_backend` is off for +the request; `lsp` answers an empty row set at once (no backend is built for wasm, so the core never raises a query there anyway) and `pipe` answers failure; `wait_input` is null because wasm must never block, and `watch_theme` and `dump_themes` are not reachable without a config directory. Of the -- cgit v1.3