summaryrefslogtreecommitdiff
path: root/src/lsp/lsp_client.zig
Commit message (Collapse)AuthorAge
* A rename preview's rows are one format whichever file they are in: ↵Gabriel Schneider23 hours
| | | | | | | | | `file:L:C-E`, the range's end too, for the asked-about file as for the others The asked-about file's rows said `file:L:C` while other files' said `file:L:C-E`. lsp-rename-files is re-recorded for the one row it shows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A language server goes with its children when reaped, and every server's ↵Gabriel Schneider24 hours
| | | | | | | | | | | | | | process group is killed as pardes exits: no zls or `zig build --build-runner` outlives the editor The server is spawned with setsid, its own group's leader, but reap() signalled only its pid, and nothing reaped the servers at exit: the socket closing was left to tell them. zls busy in its build runner at a cold start did not notice, and lived on with its `zig build` for as long as no one killed it (found as three orphans 40 minutes after their sessions had gone). reap() now signals the group, and an atexit hook, registered at the first spawn, kills every server's group. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A language server that failed a moment ago is said to have failed, with when ↵Gabriel Schneider24 hours
| | | | | | | | | | it is tried again, not `language server for .zig not found` During the backoff after a failed spawn or handshake, ensure() answered NoServer, which the client turned into "not found" for a server that is installed. It is now Backoff, said `zls failed recently; retry in Ns`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A Rename the server answers for this file alone, while other open files of ↵Gabriel Schneider24 hours
| | | | | | | | | | | | | | | | | its language say the name, is previewed, never applied; Lspwhy shows the files synced first zls renaming at a declaration answers with that file's edits only, cold or warm, whatever it was told of (checked against zls directly: from a call site in main.zig it renames both files, from the declaration in util.zig it never does), so the first Rename applied in util.zig and left main.zig broken. The client now looks for the old name in the other open files of the language; when one says it and the answer left it alone, the edits are a preview with a row naming each such file, and the message row says the server renamed in this file only. Lspwhy carries the open files too, so its trace shows `synced X first` for the query it explains. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Lspinfo before any query says a server is not started yet, its first query ↵Gabriel Schneider26 hours
| | | | | | | | | | starting it, not `off` while it is on PATH A server is spawned on its first query; until then its row said `off`, which reads as disabled. It now says `not started yet (its first query starts it)`; a server disabled by its environment still says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A Rename, references and the like tell the server of every open file of its ↵Gabriel Schneider26 hours
| | | | | | | | | | | | | | | | language first, so a rename reaches files it had not seen and the preview lists them zls renames only in the documents in its store, and syncDoc told it of a file only when a query was asked from it, so renaming in progress.zig left main.zig unchanged and broken, with no preview. For a query whose answer can reach other files (rename, references, implementation, workspace symbols, calls and type hierarchy), the host snapshots every other open file and the client syncs those its server answers for first. The mock server answers a rename in each document it was told of; lsp-rename-files opens main.rs by a look, renames from lib.rs, and its preview lists both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Lspwhy explains the last language server query asked, its kind, argument and ↵Gabriel Schneider33 hours
| | | | | | | | | | | | | | | | place, not always a definition at the cursor Lspwhy said it explains how the last request was answered, but it always replayed a definition query at the current cursor. So after a failed Hover it narrated a gd somewhere else, which told nothing about the failure. Now the core remembers the last query (kind, argument, pane, offset), and Lspwhy sends it as `<kind> <arg>`, at the query's offset when asked from the same pane. The client narrates that kind: lsp.explaining reads it, and the heading names it ("the hover query at byte N"). With nothing asked yet it is a definition, as before. The effect's arg grows to 160 bytes so a 128-byte argument fits with its kind. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Zig files go to zls as a child process through the protocol client, as every ↵Gabriel Schneider33 hours
| | | | | | | | 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 <[email protected]>
* A language with no server to start says language server for .py not found, ↵Gabriel Schneider33 hours
| | | | | | | | not that it did not answer A question about a file whose language server is not there came back as no answer at all, which the core said as the language server did not answer. The client now answers @none language server for <ext> not found, ENOENT by its words. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Every child starts with its signals at their defaults and none blockedGabriel Schneider33 hours
| | | | | | Shells, command panes, language servers, the link opener and the v9fs mount inherited the editor's signal mask (the tty's blocked SIGWINCH) and anything it ignored (a SIGHUP nohup ignored), since only handlers reset at exec. Each fork now resets every disposition and clears the mask before its exec (resetChildSignals); std's spawn for selection pipes runs with the mask cleared across it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Callers and Callees on a .zig file say the language server does not answer themGabriel Schneider33 hours
| | | | | | The in-process ZLS answers no call hierarchy, and no other backend speaks .zig, so the question went nowhere and came back empty, as if nothing called the function. A question no backend answers, or a server that advertises no call or type hierarchy, now answers @none with why, which the core says. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Highlight exact source occurrences in LSP references and goto resultsGabriel Schneider33 hours
|
* Refactor panes and filesystem; replace FUSE with 9PGabriel Schneider2026-09-07
| | | | | | Consolidate pane, layout, memory and host code. Serve 9P by default over Unix sockets, with runtime mounts and optional TCP/QUIC transports. Remove FUSE and obsolete proof-of-concept examples. Fix highlighting and terminal-history performance, expand differential and stress-test infrastructure, sort navigation results while preserving the next occurrence, add syntax-colored Braille minimaps, remove SPC-k, and document 9P interaction as a repository skill.
* hosts: the effects three shells kept a copy of become one, and the mac's own ↵Gabriel Schneider2026-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bugs go with them Nine read-only scouts compared every host-side concern across `src/macos.zig`, `src/tty/tty.zig`, `src/gui/gui.zig` and `src/detached/server.zig`. What they found was not a style problem: each duplicated body had drifted, and in every case the drift WAS a bug the users of that shell could see. So the fixes and the deduplication are the same change. **One PATH, adopted before the first fork.** LaunchServices hands a bundle launchd's environment, whose `PATH` is `/usr/bin:/bin:/usr/sbin:/sbin`. Every pty shell, `|` filter and language server the app forked inherited it, so `yazi` in `/opt/homebrew/bin` was absent from a Dock launch and present in the identical binary run from a terminal — the "it worked briefly" window was simply the sessions started from a shell. `shell_bin.adoptSystemPath` composes `/etc/paths` then `/etc/paths.d/*` in the order `path_helper` reads them, deduplicating on first occurrence, and runs once at startup in all four native hosts. It APPENDS: an entry already present keeps its position, so running it over a real session cannot demote a mise shim behind `/usr/bin` and silently change which `node` runs. A `PATH` that was configured is left byte-for-byte alone; only one nobody configured is repaired. `prepareForFork` folds that adoption together with the prompt-rc staging and the `BASH_SILENCE_DEPRECATION_WARNING` setenv the five hand-copied prefork sites had between them — `server.zig` had none of it, which is why every detached pane opened with Apple's zsh banner. **The LSP protocol client never worked on macOS.** It opened its control socket with `libc.SOCK.CLOEXEC`; Zig defines that constant for Linux and Darwin answers `socketpair` with `EPROTONOSUPPORT`, so the call failed before any fork, `ensure` returned `error.NoServer`, and every row in the spec table — rust-analyzer, clangd, gopls — was unreachable in every macOS build. The in-process ZLS backend kept answering, which is what made it read as "only Zig is supported". It is a plain socket plus `fcntl(FD_CLOEXEC)` now, the route `fuse.zig:943` and `nested.zig:95` already took for the same reason. The snapshot suite that covered this path had never run natively on a Mac: the harness targets defaulted to x86_64-linux. **One LSP host worker.** `src/lsp_host.zig` is the snapshot, the worker body and the job lifetime that `tty.zig` and `gui.zig` carried verbatim — `gui.zig` said so in a comment — and that `macos.zig` did not carry at all: `lsp` and `pipe` were absent from its `Host.VTable`, so the core answered its own empty answer, `SPC l i` rendered a blank panel and a `|` filter silently did nothing. All three shells share the module, and the AppKit host implements both effects. Its status sink is now REGISTERED as well as defined, so unsolicited server news reaches the message row instead of nowhere. **The animation clock measures time.** `pardes_animation_tick` advanced one scene frame per callback and published `frame_count / 60`, so scene time was a count of callbacks rather than elapsed seconds — and `AppDelegate` re-armed `asyncAfter(.now() + 0.016)` only after the previous frame's work had finished, making the true period 16 ms plus all of it. Motion ran at about three quarters of wall clock and unevenly. The tick now spends measured monotonic time in whole `frame_ns` steps and banks the remainder, so a late callback advances two frames instead of stretching one; `spendTickTime` is that arithmetic as a pure function with its own tests and no display attached. On macOS 14+ the animating run is one `CADisplayLink` phase-locked to vsync rather than a chain rebuilt after every frame; macOS 13 keeps the old chain. **Three more single definitions.** `panel_animation.paintOrder` is the moving-then-opening-then-closing composite order as a rule the core applies once in `Pardes.render` — `macos.zig` was re-sorting an already-sorted list. `selection_pipe.Tasks` is the bounded in-flight pipe table `tty.zig` and `gui.zig` each declared. `boxContains` was a fourth copy of the half-open cell test and is now an alias of `Box.contains`. **A filtered terminal stops asking libm per cell.** `Filter`'s legibility stage called `RGB.contrast` for every painted cell, and that ends in `std.math.pow` up to six times, re-deriving a ratio against a background that had not moved; the existing memo cache covered the palette reduction beside it and never this. The indexed path's input is a `u8`, so all 256 answers are enumerated once per pass — after the default roles are fixed, before the first cell is read — and what a cell names becomes an array index. Only truecolour still reduces. ReleaseFast, 190x56, Tracy: recolour 3.09 ms -> 0.130 ms, frame 3.37 ms -> 0.299 ms. The comptime luminance table is pinned to `RGB.luminance` and `RGB.contrast` by exact-equality test over every channel value and all 65 536 palette pairs, because the decision is a threshold comparison where one ULP is a different colour. A `filterInit` Tracy zone records the part that is still per-pass: 2.9 us warm against a 117 us pass, which is the measurement that says not to cache it across frames. Released as 0.0.2. `build.zig.zon` carries the version into `pardes --version` and into the `Changelog` pane through `@embedFile`, so the entries above open a `## 0.0.2` section and `## 0.0.1` closes with the tagline work of the parent commit. Two bugs here were mine, caught by review rather than by me: a double free in the macOS pipe drain arm (`Msg.free` already owns the response) that segfaulted the app on the first `|`, and a proposed `getRowAndCell` optimisation that targeted 2 of 43 draw samples while the contrast math beside it took 12 — and would not have compiled. The profile that justified it was a Debug build, which `build.zig:1160` already documents as ~5x slower than release. Native and -Dplatform=macos suites: 0 failures. All targets build with Tracy on and off; the shipped release binary contains no `___tracy_emit_zone_begin`. App reinstalled, signature verified, dmg regenerated, launched with 0 crash reports; installed binaries verified byte-identical to a fresh build.
* lsp: a protocol client for every other language, narrated on the message rowGabriel Schneider2026-09-01
The seam grows a second backend: src/lsp/lsp_client.zig speaks JSON-RPC to child language servers — rust-analyzer, clangd, gopls, tsserver, pyright are rows in a spec table — while the in-process ZLS analyser keeps .zig. One reader thread per server owns the socket, routes responses to a mailbox under the conn mutex (monotonic condvar), answers server-to-client requests, feeds the diagnostics store, and narrates $/progress and state changes through a status sink both native shells post to the transient message row: "rust-analyzer: cargo check 88% 955/1083" lands where a save narrates, with the same clock. Chatty progress is throttled and deduplicated; settled states always land, which is also what makes the goldens deterministic. Nothing wedges and nothing healthy dies: waits are deadline-bounded, a timeout cancels and returns no rows, three consecutive timeouts restart the server ONLY while it is idle (an indexing server is narrating its own excuse), spawn and handshake failures back off 10s to 2min, a crash shortly after ready counts as a failure, and only a missing binary disables a spec. PARDES_LSP_{RS,C,GO,TS,PY} override binaries; empty disables; the snapshot harness pins RS to test/lspmock.zig and empties the rest. Mutating answers really mutate now: the @put record beside rename @edit carries per-range text, so = applies the formatter (both backends) and a same-file WorkspaceEdit rename applies atomically, one undo step, narrated ("renamed 2 range(s)"); a multi-file rename previews as rows instead of half-applying. Malformed responses fail closed: coordinates validated not clamped, one bad TextEdit poisons the whole edit set, poison frames kill the connection instead of buffering forever, decoded control bytes reject a uri, hierarchy items too deep to reserialize are skipped. Four kinds helix does not have, on SPC l: c/C incoming/outgoing calls (rows are call sites), t/T super/subtypes. Pull diagnostics (3.17) preferred when advertised. Help gains a language-keys footer for the motions no builtin row could carry; lsp.rel and look.grep now share one path-shortening rule. zig build lspprobe drives the seam from the CLI (comma-separated kinds share one server); measured against a 1083-crate workspace warm: gd 26ms, gr 213 rows 165ms, incoming calls 212 sites 197ms, document symbols 670 rows 347ms. docs/lsp.md tells the whole story; lsp-evaluation.md gets an addendum.