Large-file fast path: 100 MB netlists open in 40 ms
Owner-requested round, the last of the large-workarea wave. Above lucisv.largeFile.threshold (4 MiB default, 0 disables) a buffer opens as a line index and nothing else — no lex, no parse, no semantics, and its path removed from the index sources so nothing describes it by stale disk bytes. Viewport highlighting lexes only the requested window (snap to a line boundary, budget-bounded backward comment scan, imperfection documented); semanticTokens/full answers the spec's cancellation errors because the shipped VS Code binary marks tokens complete on ANY non-error answer and never asks for ranges again — settled by reading the bundle, verified independently by QA, pinned with the client-library citations. Same-file definition/references shipped on measurement (worst 37 ms vs the 150 ms budget); every other handler answers as the empty file by construction; formatting alone says why aloud. Two client facts recorded: VS Code never syncs files over 50 MB, and above 20 MB our viewport tokens are the only color. QA rejected the first cut on the round's true shape — thousands of tokens on one long line went quadratic through per-call UTF-16 conversion (7.86 s to color one 269 KB line). The fix adds a monotonic PositionWalker to convert.rs (restart-on-backwards proven load-bearing by the out-of-order tail-comment shape), adopted at three sites for 546x/759x on the probes — and it fixed ordinary files' semantic tokens too (2.06 s to 232 ms on a one-line buffer), a cost the normal path had always paid. Probes are now normally-running gates with 4.5x margins, walker-vs-per-call equivalence swept over gnarly fixtures and adversarial ping-pong. 51 tests added across both rounds (dev 43+5, QA 6+3, minus overlaps), 2 ignored probes. Completes the owner's large-workarea requests. docs/features/large-file-mode/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
5e98b1a669
commit
bc606dd6bd
15 files changed
+3550
-27
No files matched your search
@@ -38,6 +38,14 @@ are answerable without a debugger. All three settings ride both settings doors
|
||||
`collect_sources` reads the scope's files (capped) and *then* folds every
|
||||
open buffer in over the top (uncapped) — the same override that has always
|
||||
made a buffer beat disk.
|
||||
**Amended 2026-08-27 by large-file-mode, and this is the one exception:** a
|
||||
buffer over `lucisv.largeFile.threshold` (4 MiB by default) was never lexed
|
||||
or parsed at all, so it contributes *nothing* to the index — and it takes
|
||||
the disk copy of its own path out with it, rather than leaving the index
|
||||
describing bytes the buffer no longer has. The two settings do not overlap
|
||||
in intent: this one is about files nobody asked for, that one is about the
|
||||
file on screen. The interaction table is in
|
||||
`docs/features/large-file-mode/README.md`.
|
||||
- **The cap is enforced with `fs::metadata` before the read.** The whole
|
||||
saving is that a 200 MB netlist is never read into memory; a cap applied
|
||||
after `read_to_string` would be a cap that costs what it saves. A file whose
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -25,8 +25,8 @@ looks like language knowledge in here is a bug or a `Handshake` request.
|
||||
| `textDocument/didChange` | `sync::apply_changes` | Incremental sync: the ranges are applied in order to the buffer the server holds, then one `set_document` + one `publish`. A rangeless change still replaces the whole buffer, so a full-sync client is unaffected. See `docs/features/incremental-sync/README.md` |
|
||||
| `textDocument/diagnostic`, `workspace/diagnostic` | the same parse+lint pass | The 3.17 pull model, served to a client that advertised `textDocument.diagnostic` — which is then pushed nothing at all. `resultId` is one generation counter, bumped by a buffer change and by an index rebuild; the workspace report covers the **open buffers**. Same feature README |
|
||||
| `textDocument/selectionRange` | `Document.tokens`, AST spans, `pairs::analyze` | Expand-selection: one strictly nesting chain per requested position, token → statement → block → item → file. No expression step. See `docs/features/selection-range/README.md` |
|
||||
| `textDocument/semanticTokens/full` | `vlog_parser::tokenize` + `Semantics` | Delta-encoded, split at line boundaries. Stamped with a `resultId` since 2026-08-26, so a delta can name it |
|
||||
| `textDocument/semanticTokens/range` | the same classification pass | The visible lines only, for the first paint of a large file. A **self-contained** answer: the tokens overlapping the range, kept whole, re-encoded from the start of the document. No `resultId` — a partial view is not what a delta is computed against. See `docs/features/semantic-tokens-delta/README.md` |
|
||||
| `textDocument/semanticTokens/full` | `vlog_parser::tokenize` + `Semantics` | Delta-encoded, split at line boundaries. Stamped with a `resultId` since 2026-08-26, so a delta can name it. **Declined with an error on a buffer over `lucisv.largeFile.threshold`** (2026-08-27): VS Code marks a model whose document provider answered *anything* as complete and then never asks its range provider again, so an empty answer would cost a 100 MB file all of its colour — see `docs/features/large-file-mode/README.md` |
|
||||
| `textDocument/semanticTokens/range` | the same classification pass | The visible lines only, for the first paint of a large file. A **self-contained** answer: the tokens overlapping the range, kept whole, re-encoded from the start of the document. No `resultId` — a partial view is not what a delta is computed against. See `docs/features/semantic-tokens-delta/README.md`. On a buffer over `lucisv.largeFile.threshold` this is the **only** request that colours anything, and it lexes the window itself (0.25 ms for a viewport of a 100 MB file) rather than filtering a token stream that was never built |
|
||||
| `textDocument/semanticTokens/full/delta` | the same classification pass | What changed since the answer the client names: one edit replacing everything between the common prefix and the common suffix (the suffix capped so the two cannot overlap — identical lines of Verilog encode identically, which is exactly the trap). An id the server does not hold, including one from before a `didClose`, is answered in full. Same feature README |
|
||||
| `textDocument/hover` | `DefineTable`, `Semantics`, `WorkspaceIndex`, `includes::IncludeGraph`, `expand` | Macro body, or declaration kind + snippet. A macro this file does not define is answered from the workspace: the definition it **reaches through its `` `include``s** when exactly one is reachable, and every candidate otherwise. A macro card also shows what the hovered use **expands to in one step** — the body with this call's arguments substituted — when that says more than the body already does; a nested `` `INNER`` is left as written, an argument count that does not match expands nothing, and several candidates expand nothing. See `docs/features/macro-expansion/README.md` |
|
||||
| `textDocument/definition` | `includes::IncludeGraph`, then `Semantics`, then `ExternalResolutions` | A cursor on an `` `include`` line jumps to the resolved file's first byte; otherwise the in-file symbol table, then the workspace overlay, whose `Ambiguous` answer returns every location. See `docs/features/include-nav/README.md` |
|
||||
@@ -295,6 +295,23 @@ current content before it is used, and a stale, corrupt or foreign record
|
||||
costs one parse and can change no answer. Rules, the record format and the
|
||||
crash-safety argument: `docs/features/index-persistence/README.md`.
|
||||
|
||||
**A buffer over `lucisv.largeFile.threshold` (4 MiB by default) is never
|
||||
analyzed at all, since 2026-08-27** (large-file-mode). `Workspace::set_document`
|
||||
— the one place a `Document` is built — puts it on a fast path that indexes its
|
||||
*lines* and stops: no lex, no parse, no semantics, no diagnostics, no index
|
||||
entry. 41 ms for 100 MB, against the 930 ms 10 MB costs through the full
|
||||
pipeline. Its `Document` holds the analysis of the **empty file**, so every
|
||||
handler that reads the analysis answers empty without knowing the mode exists;
|
||||
only the handlers that would read the **text** are gated, in one table in
|
||||
`Server::large_file_answer`. What still works is colour — `semanticTokens/range`
|
||||
lexes the requested window and nothing else — plus same-file `definition` and
|
||||
`references` by one linear scan. `semanticTokens/full` is answered with an
|
||||
*error*, which is the one shape that leaves VS Code's viewport provider
|
||||
painting. A file on the fast path leaves the workspace index entirely, which is
|
||||
the one exception to "an open buffer is never capped". The rules, the
|
||||
approximations, the dispatch table and the measurements:
|
||||
`docs/features/large-file-mode/README.md`.
|
||||
|
||||
**Walked files over `lucisv.index.maxFileSize` (1 MiB by default) are not read
|
||||
at all** — the size is taken from `fs::metadata` before the read, so a
|
||||
generated netlist costs one `stat` rather than minutes of parsing. The cap is
|
||||
@@ -706,6 +723,11 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
|
||||
3.18 items **parked** with their evidence and re-check triggers: snippet
|
||||
`WorkspaceEdit` edits and `workspace/textDocumentContent`, neither of
|
||||
which the pinned `vscode-languageclient@9.0.1` can consume.
|
||||
- [x] The **large-file fast path** — delivered by **large-file-mode**
|
||||
(2026-08-27): a buffer over `lucisv.largeFile.threshold` is line-indexed
|
||||
and nothing else, coloured a viewport at a time by
|
||||
`semanticTokens/range`, and answers everything else empty.
|
||||
`docs/features/large-file-mode/README.md`.
|
||||
- [ ] **Not done:** editor packaging (the VS Code extension and the
|
||||
`lspconfig` snippet are their own TODO.md §6 item).
|
||||
|
||||
|
||||
Reference in new issue
Block a user