atoll build, check, run, test and serve compile a project through
the layered compile in atoll-driver: each dependency sealed into a layer
kept on disk, then the project’s own files compiled over the sealed world. What a compile keeps for
the next is that pipeline’s own output, keyed by its inputs.
The language server’s database, atoll_lsp::db, is not a second compiler.
It holds what the editor has open, memoizes what is cheap to keep per file,
and compiles the project through the same pipeline.
Tracked inputs
| Input | Examples |
|---|---|
SourceFile |
Stable path, module path, mutable file contents |
Project |
Root module, ordered files, dependencies, host allowlist, datasource routing, package directories |
The editor updates a SourceFile through its Salsa setter as the user types.
Changing a file’s contents invalidates the queries that read that file.
Adding, removing or reordering a project’s files changes its file list, and
with it the project’s compile. A setter stamps a new revision even when the
value is unchanged, so the editor compares before it writes.
Queries
SourceFile ─→ parse_file ─→ position_index
│
dependency files ─┼─→ project_seed_q (sealed dependencies)
│ │
project files ────┴──────────┴─→ sema_project_q ─→ compile_project_q
│
└─→ Diag accumulator (published diagnostics)parse_fileis memoized perSourceFile. Editing one file reparses that file; unchanged files keep their priorArc<ParsedFile>.project_seed_qseals the project’s dependencies. It reads the dependency files alone, so an edit to the app leaves it cached, and a keystroke never re-checks a module the app imports.sema_project_qcompiles the project’s own files over that sealed world, through the pipeline every command takes. The dependencies’ diagnostics come first, as the CLI orders them.contracts_qruns the project’s contracts.
Hover, go to definition, completion, inlay hints, references and signature
help all read the one compile_project_q result, so an edit pays for one
compile however many features ask about it.
Incremental parses
The language server can populate a separate incremental parse cache for an
exact (path, contents) pair. parse_file accepts that parse only when the
contents match. Otherwise it performs a normal parse, so one source snapshot
has one parse.
Query design rules
When adding a query:
- key it on the smallest stable identity, not a transient pointer;
- read every tracked input that can change the result;
- return immutable shared snapshots;
- define equality or backdating only for facts truly irrelevant downstream;
- avoid ambient options that Salsa cannot observe;
- never compute a compiler stage the pipeline does not: a query composes the pipeline’s results, it does not hold a second implementation of one.