language server: semantic tokens without the resolver over the whole file per request #170
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
LANGUAGE-SERVER.md section 15, second bullet: the semantic tokens of a large document are the resolver's over the whole file on every request, about 100 ms in the largest file of the compiler. Split from #10.
Goal
textDocument/semanticTokens/fullstops resolving the whole file per request. Two reuses, in this order:compiler/src/highlight/resolve.trb,resolveFile) runs only over the top-level statements whose text changed. The tokens of every other statement are the earlier text's, moved through the mapping, as the base's resolutions already are. A statement's tokens depend on the file's global names (fileScopeOf, the outline) and on nothing else of the file, and a body-only edit leaves the outline alone; where the outline changed, there is no mapping and the whole file is resolved.Design record points (pinned)
torb highlight's, sharpened by the checker, in the legend the extension always declared; the legend and the encoding do not change.compiler/src/highlight/resolve.trbheader: the resolver reads theFileScopeand a stack of local scopes and nothing else, which is what makes a per-statement walk the same as the whole-file walk (locals are empty at the file level).Requirements
range, nodelta; the server announcesfullonly, as now). Adding either is a protocol change for a later issue.tokens.trbare also per request and per file), the PR says where the rest goes and leaves it in section 15 as what is left rather than inventing more caches.Acceptance criteria
semanticTokens/fullrequests for one version run the resolver once; a test counts resolver walks (a counter the test reads) and compares both answers.usechanged) resolves the whole file, with a test; so does the first request of a document.deprecatedSpansOf), the sharpened members and the existing token tests (compiler/tests/language-server.test.trb"five integers per token", "a deprecated declaration ...", "hover and tokens inside and outside of a changed body",tests/lsp/features.expected) pass unchanged.compiler/src/semantics/checker/expression.trb(largest file of the compiler) for a repeated request and for a request after a body-only keystroke, measured on a binary built by the forge CI (not a gate). The numbers are written into section 12, and the second bullet of section 15 is removed or reduced to what the measurement shows is left.skills/, it is regenerated.Seed
No. Existing syntax, no native, no flag.
Size and commits
One PR, one or two Conventional Commits:
perf(lsp): answer semantic tokens from what the last request resolved, and optionallydocs(lsp): measure the semantic tokens. Tier A in the forge CI.Implementer
opus / high (language server core and the highlight resolver; a wrong cache is a wrong color nobody can reproduce, so the differential test is part of the work).
Collisions
Touches
compiler/src/language-server/tokens.trb,view.trborserver.trb(the request), and maybecompiler/src/highlight/resolve.trb. #10 touchesview.trbandanalysis.trb: second to land rebases. No overlap with the running #6, #7, #9.[loop:torbscript] refine: split from #10 and made ready (acceptance criteria, pinned records, seed: no). Implementer: opus/high. Collides only with #10 on view.trb (second to land rebases), next: implement
[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T13:15:00Z
[loop:torbscript] release implement: the previous worker was killed (gateway restart) before pushing a branch, next: implement
[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T15:30:00Z