summaryrefslogtreecommitdiff
path: root/docs/lsp-evaluation.md
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-26 18:58:37 -0300
committerGabriel Schneider <[email protected]>2026-08-27 09:47:39 -0300
commit29ac9be75fdcafbd7d05c15aa9eb8490d74caa98 (patch)
tree6629cc215d6953090f6b29a7414b28cb9990e105 /docs/lsp-evaluation.md
parent11f380f6d7222f2cad93c2cdf13701ea1f903d47 (diff)
downloadpardes-29ac9be75fdcafbd7d05c15aa9eb8490d74caa98.tar.gz
pardes-29ac9be75fdcafbd7d05c15aa9eb8490d74caa98.zip
An edited row keeps its colours, four copies of forkShell become one, and Esc stops recentring
## A terminal row's ANSI colours survive being edited The loudest colour bug this editor had: one keystroke anywhere in a coloured shell row turned EVERY column of it grey. `EditAnchors` anchored a buffer line only when it was BYTE-IDENTICAL to the shell row it stood over, so a single differing byte dropped the whole row's colour projection. Worst shape is invisible: append past the pane's right edge, where the text is clipped, and the row looks the same and only its colour goes. Anchoring is byte-level now. An edit leaves the row's own bytes at both ends, and being the same bytes they keep the same colours; only what was typed has no cell under it, so only that takes none. Live, on real `fastfetch`: a 32-column blue run split into 6 + 26 around one typed character. Three defects underneath it, all found by machinery rather than by reading: * A JOIN removes a buffer line while the buffer's covered span grows, so `lines == covered` and both aligned guesses — Nth line over the Nth covered row, and the same counted from the bottom — resolved to the SAME wrong row. Every untouched row below a join went plain. Anchoring is now a streaming monotone matching: one shell-row cursor that only ever moves forward, advanced once per buffer line, linear in the buffer where the version before it was quadratic. * An EMPTY line is not evidence. Splitting a row makes one, it equals every blank row in the span, and left free to look ahead it claimed the blank row below the last output and took every coloured row in between out of reach of the lines that owned them. * Reflow under a scrolled viewport. `PageList.getTopLeft(.viewport)` returns the viewport pin verbatim, x and all, while `PageList.pin` forces x to 0 — so after a reflow remapped a tracked pin into the middle of a row, the text pass dumped row 0 from that column while the colour pass paired the fragment with the row's FIRST cells. Row 0 wore its left half's colours until the pane snapped back to live output. `bodyText` dumps from column zero now, which is also what ghostty's own renderer draws. Also here: DECSCNM (reverse video) was silently dropped whenever `tty_filter` was off, because the raw path resolved a `.none` colour by role and never consulted the mode. The test that found the first two is the one worth keeping: random editing against an ABSOLUTE oracle — every row's own text names the colour it must have — because the differential oracle it replaced was blind by construction. It skipped the edited row, which is the row the user is complaining about. ## Esc returns to a pane without moving its view Esc in body normal mode runs `Last`, "the pane you were in before this one", and that went through `focusPaneLine`, which recentred a file on the target line unconditionally. So returning to a buffer repainted the whole screen to show a line that was already on it. `focusPaneLine` takes a landing now: `.center` for the three callers going somewhere you have not been (a look target, a path a pane already holds, `@pN:LINE:COL`), `.keep` for Esc. `.keep` leaves the view alone and lets `ensureCursorVisible` — which already existed and already scrolls by the minimum into the `scroll_off` band — be the only thing that may move anything. Not `line = 0`, which `focusPaneLine` already understands as "focus and touch nothing": a background pane's view can move while you are away, because the wheel scrolls the pane under the POINTER and a resize reveals no cursor, so the recorded cursor plus a minimal nudge is what actually gets you back. Ctrl-o and Ctrl-i keep centring, and the asymmetry is structural rather than arbitrary: `Last` only ever CROSSES panes, so the pane it lands on already holds the view you left it with, while `jumpBy` can land in the SAME pane, where a long in-file jump would arrive on the very top or bottom row with `scroll_off` lines of context on one side. Helix splits the same pair the same way — its jumplist centres, its buffer switch does not. One deliberate consequence: under `.keep` a PDF's page is not restored AT ALL, because a page reveal IS that pane's view and a reveal of the page you are already on still snaps `document_scroll_y` to that page's start, discarding where you had read to. When something moved the pane while you were away — the wheel again — Esc leaves it where the wheel left it, and Ctrl-o is how you reach the recorded page. ## host_io.zig: the machine-local half of a host, once `host.zig` is the seam. The part of the answer that is identical on every host with an operating system under it — fork a pane's shell, put bytes on a disk — was written FOUR times: in tty.zig, gui.zig, macos.zig and detached/server.zig. What those copies had in common says what they were for: all four were missing FD_CLOEXEC on the pty master, so in every shell pardes has shipped, a program in one pane could read another pane's terminal. One copy now, and the wire got smaller for it: `ServerMsg.spawn` is gone. A frontend never asked the server to fork anything — the server has an operating system under it and forks through `host_io` like every other host — and `decodeClient` lost the scratch buffer that message needed.
Diffstat (limited to 'docs/lsp-evaluation.md')
-rw-r--r--docs/lsp-evaluation.md36
1 files changed, 24 insertions, 12 deletions
diff --git a/docs/lsp-evaluation.md b/docs/lsp-evaluation.md
index d9fcd243..ab502422 100644
--- a/docs/lsp-evaluation.md
+++ b/docs/lsp-evaluation.md
@@ -1,19 +1,22 @@
# Three language backends, measured
-Same core, same seam (`src/lsp/lsp.zig`), same 17-probe harness (`zig build lspbench`)
-over the same corpus. Three jj workspaces, three independent implementations,
-one function each. C landed; see **Decision** below.
+Same core, same seam (`src/lsp/lsp.zig`), same harness (`zig build lspbench`)
+over the same corpus — 17 probes at the time, 22 today. Three jj workspaces,
+three independent implementations, one function each. C landed; see
+**Decision** below.
> **This is a dated report, not a description of the tree.** Every MEASUREMENT
> below is the one taken at decision time and is deliberately left alone,
> because renumbering a comparison nobody can re-run turns a record into a
-> guess. What has moved since: `lspbench` now has **22** probes rather than 17
-> (the dot-completion work added five), `src/lsp/lsp_zls.zig` has grown from 540
-> lines to about 1,400, `test/snapshots/` holds 87 scripts rather than 56, and
-> the differential suites are `hxdiff` 481 / `hxparity` 561. The one number
-> that IS kept current is the grammar count in the Recommendation, because that
-> is an argument about today rather than a measurement of then. For what the
-> harness does TODAY, read `docs/lsp.md`.
+> guess. What has moved since, re-checked 2026-08-26: `lspbench` now has **22**
+> probes rather than 17 (the dot-completion work added five),
+> `src/lsp/lsp_zls.zig` has grown from 540 lines to **1 432**,
+> `test/snapshots/` holds **95** scripts rather than 56 (`.snap` + `.golden`
+> pairs), and the differential suites are `hxdiff` **481** (`cases.jsonl`) and
+> `hxparity` **561** (`cases.jsonl` + the 80 editing extras in
+> `parity.jsonl`). The one number that IS kept current is the grammar count in
+> the Recommendation, because that is an argument about today rather than a
+> measurement of then. For what the harness does TODAY, read `docs/lsp.md`.
| | **A · stdlib** | **B · client** | **C · in-process** |
|---|---|---|---|
@@ -98,7 +101,12 @@ real binary through the helix keymap, and pass `hxdiff` (360) and `hxparity`
**C landed.** It is what `src/lsp/lsp_zls.zig` is, and ZLS is now a fetched
dependency (`build.zig.zon`, pinned to commit `3e0d0820` on the 0.16.x branch)
so it sits in `zig-pkg/` like everything else and the build is reproducible
-from the .zon alone — no path dependency on a local checkout.
+from the .zon alone — no path dependency on a local checkout. The same commit
+is spelled a second time in `build.zig` as `const zls_version =
+"0.16.1-dev+3e0d0820"`, for ZLS's own `-Dversion-string`; the semver half
+exists nowhere in the manifest, so the duplication cannot be removed, but a
+`comptime` block beside the constant `@compileError`s unless the two name the
+same commit. See "Which ZLS, and which stdlib" in `docs/lsp.md`.
A and B were not deleted, only un-worktree'd. They remain whole commits:
@@ -118,7 +126,11 @@ second process, and its weakest number is a cache that does not exist rather
than a limit that cannot be lifted.
The one thing that should override that: **pardes ships tree-sitter grammars for
-28 languages.** C is Zig-only forever; B is the only implementation that will
+28 languages** — `src/grammar_manifest.zig`'s `all` has 29 entries, but
+`markdown_inline` carries `.exts = &.{}` on purpose: no filename ever selects
+it, and the block grammar re-enters it by name for its `inline` nodes. So 29
+grammars, 28 buffers a language server could ever be asked about. C is
+Zig-only forever; B is the only implementation that will
ever answer `gd` in a Rust or Go buffer. If language intelligence is meant to
follow the syntax highlighting, B is the strategic choice and its 721 lines are
the cheapest multi-language client anyone will write.