From 60a891ce8127c87b55aed1ff71e435cb7fbd28fc Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 11:24:31 -0300 Subject: lsp: SCIP first, the server second: the language words ask the nearest index.scip above the file (src/lsp/Scip.zig: a protobuf reader of the fields the words read, each document's occurrences with their ranges, roles and enclosing nodes, the symbols interned, a document's locals its own, with their occurrences listed by symbol, each symbol's information read again when a word wants it; loaded on the first question on the query's worker and again once the file changes, into a fixed region of two indexes, 32 MiB of index and 32 MiB of tables each, eight times rust-analyzer's index of clap_builder 4.6.7, 3.9 MB with 3.1 MB of tables); Def, type definition, Refs, SelectRefs, gi and Subtypes, Supertypes, Symbols, WsSymbols, Hover, Callers, Callees and Callstack answer from it in the server's rows (the Callstack walk takes its hops from the index or the server, each caller the function whose definition holds the call), and the server answers what it lacks (no index, a file, place or symbol it does not hold, a pane's unsaved changes) and Diagnostics, Rename, CodeAction, format, completion and declaration; an index older than its file answers and says so once; Lspinfo starts with the index (path, size, documents, symbols, when, files newer) and its log names scip; Lspwhy narrates the branch taken; the Index word runs the file's indexer (rust-analyzer scip . and the like, PARDES_SCIP_* naming another) at the project's root in a command pane; T1 cases over a hand-made index and rust-analyzer's own (test/scipfixture); the reference, setup, guide, lsp-evaluation.md, the changelog and both builtins lists say so Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/typ/builtins-gui.json | 1 + docs/typ/builtins-tui.json | 1 + docs/typ/guide.typ | 6 ++++-- docs/typ/reference.typ | 22 +++++++++++++++++----- docs/typ/setup.typ | 10 ++++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) (limited to 'docs/typ') diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index 9a8b2ced..e48dc0cd 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -53,6 +53,7 @@ {"name": "HoverGlow", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A soft underline of light under the word a look-hover would open, on or off."}, {"name": "InactiveDim", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off."}, {"name": "Incl", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Incl, for the session: `Incl dir ...` adds directories a look at a name found nowhere else is tried in (`stdio.h`, ``), bare lists them, `Incl -` empties the list."}, + {"name": "Index", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Run the file's language indexer at its project root, writing the index.scip the language words ask first."}, {"name": "Joincol", "leader": "SPC c j", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Fold the active pane's column into the one on its right, keeping its panes."}, {"name": "JumpScope", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "file, all", "doc": "What Back and Forward keep to: file, the focused pane's file until it runs out that way, or all, every place in order."}, {"name": "JumpTrail", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a terminal, a jump of the cursor leaves a short trail that fades, on or off."}, diff --git a/docs/typ/builtins-tui.json b/docs/typ/builtins-tui.json index f5fe199c..93ae6a8f 100644 --- a/docs/typ/builtins-tui.json +++ b/docs/typ/builtins-tui.json @@ -45,6 +45,7 @@ {"name": "Hover", "leader": "SPC l k", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Ask the language server about the symbol under the cursor."}, {"name": "InactiveDim", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off."}, {"name": "Incl", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Incl, for the session: `Incl dir ...` adds directories a look at a name found nowhere else is tried in (`stdio.h`, ``), bare lists them, `Incl -` empties the list."}, + {"name": "Index", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Run the file's language indexer at its project root, writing the index.scip the language words ask first."}, {"name": "Joincol", "leader": "SPC c j", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Fold the active pane's column into the one on its right, keeping its panes."}, {"name": "JumpScope", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "file, all", "doc": "What Back and Forward keep to: file, the focused pane's file until it runs out that way, or all, every place in order."}, {"name": "JumpTrail", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a terminal, a jump of the cursor leaves a short trail that fades, on or off."}, diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 29535c39..7c5b4a8e 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -279,8 +279,10 @@ continue alongside every line of a multiline signature and through screen wrapping. Cross-directory Look paths are shortened when possible. #btn("B3") or #key("Enter") on a location opens and reveals that source pane. #word("LookNext") / #word("LookPrev") (#keys("SPC j n", "SPC j p")) -select locations without opening them. The view follows the language -server's static call hierarchy; recursive paths are marked `↻`, and a +select locations without opening them. The view follows the static call +hierarchy of the project's `index.scip` (each caller the function whose +definition holds the call), else the language server's; recursive paths +are marked `↻`, and a hierarchy deeper than the limit invites continuing from another function. Every caller is listed: the walk runs as long as the server keeps answering, says how many callers it has found on the message row once it takes more diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index d3210814..a7db9e2d 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -254,7 +254,16 @@ A line written to #file("exec") is #word("Exec"): - A line starting with `#` is a comment, as in a shell: it runs as nothing, silently, here and in every ctl. - The language server's words ask about a file pane's text at its cursor - (set it with #file("addr") and `dot=addr` first): #word("Hover") fills + (set it with #file("addr") and `dot=addr` first). Each asks the nearest + `index.scip` above the file first (a SCIP index an indexer wrote, read + again once it changes; #word("Index") runs the file's indexer at its + project's root in a command pane) and the file's language server only + when the index has nothing to say: none above the file, a file it does + not hold, nothing indexed at the cursor, a symbol it does not know, a + pane with unsaved changes, or a word only a server answers (declaration, + #word("Diagnostics"), #word("Rename"), #word("CodeAction"), format, + completion). An index older than the file still answers, and says so + once on the message row. #word("Hover") fills `+Hover`; #word("Def") and #word("Refs"), in the tag of a file a server speaks for, are `gd` and `gr`, and given a symbol (a 2-1 chord's selection) ask at its occurrence nearest the cursor; #word("Rename") `new` renames the symbol in the file and says how many @@ -275,10 +284,13 @@ A line written to #file("exec") is #word("Exec"): #word("Callers") and #word("Callees") keep their short lists and single-result jumps. #word("Diagnostics") and #word("Symbols") list the file's in `+Search`; - #word("Lspinfo") fills `+Lsp`, the pane its write answers, with which - server serves the file and its state (`not started yet` until its first - query starts it, ` failed recently; retry in Ns` while it backs - off); + #word("Lspinfo") fills `+Lsp`, the pane its write answers, with the + 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; + 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 write returns once the answer is in; a pane with no file is refused. - acme's words run as pardes's where it has one (`Put` is #word("Save"), diff --git a/docs/typ/setup.typ b/docs/typ/setup.typ index f49c9075..466b178a 100644 --- a/docs/typ/setup.typ +++ b/docs/typ/setup.typ @@ -117,6 +117,16 @@ pardes starts a language server for a file it knows, from `PATH`: #word("Lspinfo") (#key("SPC l i")) says what is running. +Before a server, a language word asks the nearest `index.scip` above the +file, at most seven directories up: a SCIP index (scip-code.org) of the +project, which answers its words at once, with no server running. +#word("Index") runs the file's indexer at the project's root in a command +pane, and the index is read again once the indexer is done: `rust-analyzer +scip .`, `scip-clang`, `scip-go`, `scip-typescript index`, `scip-python +index .` or `scip-zig` (`PARDES_SCIP_RS` and the like name another, as +`PARDES_LSP_RS` does a server). Nothing indexes behind your back: run it +again after big changes. An index of more than 32 MB is refused. + = Fonts and themes The terminal build uses your terminal's font. The SDL window carries -- cgit v1.3