Repository navigation
Responsiveness: fewer completions, single parse, one diagnostics message per pass, shape cache (2/4) - #42
Merged
Conversation
A completion at an empty predicate position returned about 3,400 items, nearly all of them prefixes from prefix.cc. That was slow to send and buried the useful suggestions. Prefixes the document declares are always suggested. Undeclared prefixes (built-in vocabularies, then prefix.cc in popularity order) are only suggested once something was typed, and at most 30 (`MAX_UNDECLARED_PREFIXES`). Removes the commented-out previous version of the helper.
`spawn_or_insert` ran the parse schedule itself, and its callers (opening a document, loading a background document, configured shapes) ran it again right after, so every new document was parsed twice. It no longer parses; the callers do, once everything is added. The built-in ontologies at startup and the test helper `create_file`, which relied on the implicit parse, now parse explicitly.
The publisher sends a document's full, merged diagnostics on every publish, once per reason (syntax, prefixes, namespaces, shapes), so one edit sent 8 `publishDiagnostics` messages for the document. The server now lets a pass finish (10 ms), drains what is queued and sends each document's latest set once (`diagnostics::coalesce`). Tests: `coalesce` keeps the latest set per document, and over stdio one edit now publishes once (it published 8 times before).
Hover, completion and shape templates rebuilt the index of every visible shape triple on each request. `ShapeGraph` now holds shared references (`Arc`) to the shape documents' triples and indexes positions instead of borrowing, so it can outlive a request; `ShapeCache` (a `Local` of each system) reuses it while the visible documents and their triples are the same. Keyed by `Arc` identity: changed triples or another set of documents build a new graph.
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of four stacked PRs, based on #41. Merge #41 first; this PR's diff only shows its own commits.
Prefix suggestions
MAX_UNDECLARED_PREFIXES).One parse per new document
spawn_or_insertran the parse schedule itself, and its callers (opening a document, loading a background document, configured shapes) ran it again right after. Every new document was therefore parsed twice. It no longer parses; the callers do, once everything is added. The built-in ontologies at startup and the test helpercreate_filerelied on the implicit parse and now parse explicitly.One diagnostics message per document per pass
The publisher sends a document's full, merged diagnostics once per reason (syntax, prefixes, namespaces, shapes), so one edit sent 8
publishDiagnosticsmessages for the document. The server now lets the pass finish (10 ms), drains what is queued and sends each document's latest set once (diagnostics::coalesce).Shape index cache
Hover, completion and shape templates rebuilt the index of every visible shape triple on each request.
ShapeGraphnow holds shared references (Arc) to the shape documents' triples and indexes positions instead of borrowing, so it can outlive a request.ShapeCache(aLocalof each system) reuses it while the visible documents and their triples are the same.Arcidentity: changed triples or another set of documents build a new graph.Not included
Testing
e2e/tests/prefix_suggestions.rs: declared prefixes only for an empty word, at most 30 matching undeclared prefixes for a typed word, and a declared prefix suggested once;coalesceand the shape cache.cargo test --workspace(593 tests),cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warnings(Rust 1.100) pass.