Indexed references: postings replace the per-request refactor walk
textDocument/references now reads declaration-to-occurrence postings merged in WorkspaceIndex from compact per-file reference facts, with open buffers overlaying live semantics — 0.062 ms/request over 820 files vs 21.7 ms for the old Workspace::sources() walk (~350x). The walk stays as rename's engine and the equivalence oracle in tests. FACTS_FORMAT 1->2 discards v1 caches whole. Cursor lookups (symbol_at/reference_at/token_at) and macro-define lookup move to binary-searched sorted tables; include definition inspects only the cursor's line. Ambiguity refusals preserved throughout. External dev: codex. Lead-reviewed, gates re-run, probe reproduced. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
27fc216df3
commit
b2d778eb8d
13 files changed
+768
-81
No files matched your search
@@ -213,6 +213,10 @@ impl WorkspaceIndex {
|
||||
|
||||
- `add_file` is now `add_facts(FileFacts::of(path, src))` — one implementation,
|
||||
so the cached path cannot drift from the parsed one.
|
||||
- Since indexed navigation (2026-08-27), the private facts also carry compact
|
||||
local/external reference records used to rebuild declaration-to-occurrence
|
||||
postings. That encoding change bumped `FACTS_FORMAT` from 1 to 2; no cache
|
||||
migration is attempted or needed.
|
||||
- `record_path` is public separately because a store keyed by path reads that
|
||||
field out of every record it holds and decodes only the ones it is asked
|
||||
for.
|
||||
@@ -337,16 +341,17 @@ module m; sub u (); endmodule
|
||||
```
|
||||
|
||||
```
|
||||
2f0a8bd7c1d1f5a1→/w/m.sv→D→1→d→W→-→8→0→11→8→9→U→1→m→module→19→20→M→0→I→1→sub→m→19→20→12→41→22→25→S→0→9b1c04e2a7f3d081
|
||||
2f0a8bd7c1d1f5a1→/w/m.sv→D→1→d→W→-→8→0→11→8→9→U→1→m→module→19→20→M→0→I→1→sub→m→19→20→12→41→22→25→S→0→R→1→e→sub→1→sub→22→25→9b1c04e2a7f3d081
|
||||
```
|
||||
|
||||
— one define (`d` for `` `define``, name `W`, `-` for "no parameter list",
|
||||
body `8`, span `0..11`, name span `8..9`), one file-scope unit (`m`, a module,
|
||||
name span `19..20`), no members, one instantiation edge (of `sub`, owned by
|
||||
`m` whose name is at `19..20` and whose declaration runs `12..41`, with the
|
||||
site's own name span `22..25`), no subclasses, and the checksum of all of
|
||||
that. The record is what lies between the hash field and the checksum; both
|
||||
hashes above are illustrative.
|
||||
site's own name span `22..25`), no subclasses, and one external reference fact
|
||||
(`e`, name `sub`, one resolution path also named `sub`, occurrence `22..25`),
|
||||
then the checksum. The record is what lies between the hash field and the
|
||||
checksum; both hashes above are illustrative.
|
||||
|
||||
**Any change to what a record holds or how it is written bumps
|
||||
`FACTS_FORMAT`** — that is the rule, written at the constant, and it is what
|
||||
|
||||
@@ -33,7 +33,7 @@ looks like language knowledge in here is a bug or a `Handshake` request.
|
||||
| `textDocument/typeDefinition` | `type_def`, then `nav::definition` | The same jump one token to the left: from a name to where its **type** is declared — a `typedef`, an `interface`, a `class`, or the module an instance name stands for. The tree says which declaration a position is in and where its type name is written; the answer is then `definition` of *that* name, so cross-file resolution, ambiguity and position conversion are all the ones F12 already uses. One hop on an alias chain, an empty list for a built-in. See `docs/features/type-definition/README.md` |
|
||||
| `textDocument/linkedEditingRange` | `linked`, over `Document.tree` | SV's closing labels, edited as one name: the cursor on either half of `module m ... endmodule : m` (and of `endfunction`/`endtask`/`endclass`/`endpackage`/`endinterface`/`endclocking`, a named `begin`/`fork`, a generate block, and the prefix-labelled `b : begin ... end : b`) answers **both** ranges plus the SV `wordPattern`. The pair comes off one AST node — `name_span` with `end_label_span` — never off a text match, so four identical names at two nesting levels still pair syntactically. Two `null`s on purpose: a closer with **no** label (nothing to co-edit, and this never offers to create one) and a **mismatched** one (the spec requires identical text; linking would silently rewrite broken code). Escaped identifiers are excluded. See `docs/features/linked-editing/README.md` |
|
||||
| `textDocument/documentLink` | `includes::IncludeGraph` | One link per **resolvable** `` `include``, covering the quoted path, target already resolved (`resolveProvider: false`). Search order: the including file's own directory, then each `+incdir+` of the configured filelist in order; the `<angled>` form skips the first rung. An include nothing answers to gets no link and no error. Same feature README |
|
||||
| `textDocument/references` | `vlog_refactor::find_references`, else `Semantics::references_of` | Cross-file when the symbol is one the workspace index holds (a module, a package, an exported member, a port); in-file for everything else, which is what keeps a local `wire` off the workspace walk. See `docs/features/references-nav/README.md` |
|
||||
| `textDocument/references` | `WorkspaceIndex::references_to`, else `Semantics::references_of` | Cross-file when the symbol is one the workspace index holds (a module, a package, an exported member, a port). Saved uses are declaration-to-occurrence postings built with the project index; open buffers overlay live semantics. No request-time project scan; returned spans are converted per touched file in one batch. See `docs/features/references-nav/README.md` |
|
||||
| `textDocument/documentHighlight` | `pairs::analyze`, else `Semantics::references_of` | A scope keyword highlights its own closer; anything else highlights the symbol's occurrences in this file. Kind is always `Text`; neither answer means `null`, so the editor keeps its word highlighting. Same feature README |
|
||||
| `textDocument/foldingRange` | `pairs::analyze` + comment trivia | One `Region` per matched scope pair, folded through the line *before* the closer so `end`/`endmodule` stays visible, plus one `Comment` per multi-line block comment. An unmatched opener folds nothing. Same feature README |
|
||||
| `textDocument/documentSymbol` | `Semantics::document_symbols` | Hierarchical |
|
||||
@@ -260,7 +260,7 @@ empty until the first `didOpen`, which is the whole saving on a large project.
|
||||
|
||||
**Stated plainly, because it is what a user notices:** every cross-file answer
|
||||
in the table above is **scope-relative**. A definition, a `workspace/symbol`
|
||||
hit, an `incomingCalls` census, a `subtypes` list, a `find_references` sweep or
|
||||
hit, an `incomingCalls` census, a `subtypes` list, a references lookup or
|
||||
a workspace rename covers the files in scope and no others — a symbol in a
|
||||
folder the scope has not reached does not exist as far as this server is
|
||||
concerned, exactly as one outside a filelist never did. Opening a file in that
|
||||
@@ -461,17 +461,17 @@ spans, and `defines::{collect_defines, Define, DefineTable}`.
|
||||
reference_at, references_of, document_symbols, symbol, symbols, references,
|
||||
reference_id_at, scope}`, `Symbol { name, kind, name_span, decl_span, scope,
|
||||
child_scope }`, `Scope::owner`, `SymbolKind`, `Resolution`, `DocumentSymbol`,
|
||||
and the workspace layer — `WorkspaceIndex::{build, path, units, member,
|
||||
find_define, workspace_symbols}`, `resolve_external`,
|
||||
and the workspace layer — `WorkspaceIndex::{build, path, file_id, units,
|
||||
member, find_define, references_to, references_are_ambiguous,
|
||||
workspace_symbols}`, `resolve_external`,
|
||||
`ExternalResolutions::{definition_of, get}`, `ExternalTarget::best`,
|
||||
`Definition`, `Def`.
|
||||
|
||||
**Consumed from `vlog_refactor`:** `prepare_rename`, `rename`,
|
||||
`instantiation_plan` and friends, the port refactorings, and — since
|
||||
references-nav (M7) — `find_references(files, file, offset,
|
||||
include_declaration) -> Result<Vec<(PathBuf, TextRange)>, String>`, which is
|
||||
the cross-file half of `textDocument/references`. Every one of them takes the
|
||||
same `Workspace::sources()` file set.
|
||||
`instantiation_plan` and friends, and the port refactorings. Rename consumes
|
||||
the `Workspace::sources()` file set. `find_references` remains available and
|
||||
is the equivalence oracle for the indexed references test, but is no longer
|
||||
called by the request handler.
|
||||
|
||||
**Consumed from `vlog_formatter`:** `format_source(&str, &Config) ->
|
||||
Result<String, FormatError>` and `Config { max_width, indent_width }`.
|
||||
@@ -677,11 +677,11 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
|
||||
answering across the workspace means resolving every other file's
|
||||
references *into* this one — an inverted index the workspace layer does
|
||||
not build. It is a real feature, not a small addition.~~ Delivered by
|
||||
**references-nav** (M7). The inverted index was never built: M2's rename
|
||||
already resolves every *other* file's references and asks whether each
|
||||
one lands on this declaration, so the answer came from sharing that walk
|
||||
(`vlog_refactor::find_references`) rather than from new machinery. The
|
||||
same round added `documentHighlight` for symbols and `foldingRange`.
|
||||
**references-nav** (M7). It initially shared M2's rename walk; on
|
||||
2026-08-27 `WorkspaceIndex` gained persisted declaration-to-occurrence
|
||||
postings and the request moved to indexed lookup, with the old walk kept
|
||||
as a correctness oracle. The same round added `documentHighlight` for
|
||||
symbols and `foldingRange`.
|
||||
`docs/features/references-nav/README.md`.
|
||||
- [x] ~~**Not done:**~~ `lucisv.toml` discovery, `.gitignore`-aware indexing —
|
||||
delivered by lucisv-core-lift (both Handshakes below marked DELIVERED).
|
||||
|
||||
@@ -29,22 +29,24 @@ predicate, and three handlers.
|
||||
edited but not saved, when the file is new) is answered in-file until the
|
||||
next rebuild. That is the same staleness window every other cross-file
|
||||
answer already has, documented in `docs/features/lucisv-server/README.md`.
|
||||
- **A references answer costs what a rename costs.** The cross-file path calls
|
||||
`Workspace::sources()`, which re-reads every in-scope file, and then
|
||||
re-analyzes the files that spell the name. Measured at 218 ms over the
|
||||
860-file corpus (below); the gate above is what keeps a local signal at
|
||||
1 ms rather than paying that on every request.
|
||||
- **A references answer is an indexed lookup.** Each `FileFacts` record stores
|
||||
compact facts for references to externally reachable declarations. The
|
||||
finished `WorkspaceIndex` resolves those facts once into declaration-to-use
|
||||
postings, and a request reads only that posting list. Open documents replace
|
||||
their saved postings with live `Semantics`, preserving unsaved additions and
|
||||
deletions. The old `Workspace::sources()` + refactor walk remains rename's
|
||||
correctness engine but is no longer on the references request path.
|
||||
- **A refusal degrades to the in-file answer, it is not an error.** The shared
|
||||
engine refuses an ambiguous name (declared in two indexed files) exactly as
|
||||
a rename does. `textDocument/references` is a read-only convenience, so the
|
||||
handler sends the file's own occurrences rather than a `RequestFailed`: a
|
||||
highlight the editor can draw beats a shrug, and the refusal the user
|
||||
actually needs to see is the one on the rename they then attempt.
|
||||
- **Reference spans are trusted the way rename trusts them**, minus the edit
|
||||
safety check: `find_references` still drops any span that does not slice
|
||||
back to the name it claims, but it does not run the re-parse verification
|
||||
pass, because it produces no edits and CLAUDE.md invariant #1 is about
|
||||
output, not about a list of places.
|
||||
- **Reference spans are produced by the semantic analysis and versioned with
|
||||
the file facts.** A cache entry is content-addressed, so a saved span cannot
|
||||
be paired with different bytes; an open file contributes live spans instead.
|
||||
Location conversion fetches and line-indexes each touched file once, however
|
||||
many occurrences it contains.
|
||||
- **Read/write is not distinguished** in `documentHighlight`. LSP permits a
|
||||
plain `Text` kind, and telling a read from a write in Verilog means
|
||||
classifying continuous vs. procedural assignment, port direction and
|
||||
@@ -56,7 +58,8 @@ predicate, and three handlers.
|
||||
|
||||
## Handshakes
|
||||
|
||||
**New public API in `vlog_refactor`** — the one handshake this round changes:
|
||||
**The original public API in `vlog_refactor`**, retained for rename and as the
|
||||
equivalence oracle in tests:
|
||||
|
||||
```rust
|
||||
pub fn find_references(
|
||||
@@ -72,7 +75,7 @@ current text, open buffers already overlaying disk). The result is sorted by
|
||||
path then by position; an `Err` is the sentence a rename at that position
|
||||
would refuse with.
|
||||
|
||||
**Where the sharing lives, and why there.** The collection walk is
|
||||
**Where the original sharing lives.** The collection walk is
|
||||
`Scope::collect_occurrences` in `crates/vlog_refactor/src/rename.rs` — lifted
|
||||
out of `collect_edits`, which now calls it and turns the spans into edits.
|
||||
`find_references` (`crates/vlog_refactor/src/references.rs`) calls the same
|
||||
@@ -81,15 +84,24 @@ spans. The alternative considered was lifting the walk into `vlog_semantic`;
|
||||
it was rejected because the walk is not a semantic query — it needs the
|
||||
`Scope` cache, the workspace overlay *per file*, and the ambiguity policy,
|
||||
all of which are refactor-crate concerns, and `lucisv_server` already depends
|
||||
on `vlog_refactor`. Copy-pasting the walk into the server was never on the
|
||||
table: a references list that disagreed with what a rename would touch is a
|
||||
lie about what lucisv is going to do.
|
||||
on `vlog_refactor`. The indexed implementation is compared directly with this
|
||||
walk in the server tests, so moving the hot path does not create a second
|
||||
semantic answer.
|
||||
|
||||
**Consumed from `vlog_semantic`** (all pre-existing, nothing requested):
|
||||
**New public API in `vlog_semantic`:** `WorkspaceIndex::{file_id,
|
||||
references_to, references_are_ambiguous}`, plus `DefinitionKey` and
|
||||
`ReferenceSite`. `FileFacts`' encoded shape now includes local and unresolved
|
||||
external reference facts, and `FACTS_FORMAT` is **2**. A changed file rebuilds
|
||||
the merged postings from compact in-memory facts; it does not reread or parse
|
||||
the other files. `Semantics::{symbol_at, reference_at, reference_id_at}` and
|
||||
`Document::token_at` now use start-sorted position tables and binary search.
|
||||
|
||||
**Consumed from `vlog_semantic`:**
|
||||
`Semantics::{reference_at, reference_id_at, references_of, symbol, symbol_at,
|
||||
scope}`, `Scope::owner`, `Symbol::{name, scope, name_span}`,
|
||||
`ExternalResolutions::get`, `ExternalTarget::best`,
|
||||
`WorkspaceIndex::{units, member}`.
|
||||
`WorkspaceIndex::{units, member, file_id, references_to,
|
||||
references_are_ambiguous}`.
|
||||
|
||||
**Consumed from `vlog_parser`**: `token::Comment { span }` trivia and
|
||||
`LineIndex::line_col` for folding.
|
||||
@@ -108,11 +120,22 @@ and none was made.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] **Indexed navigation performance (2026-08-27):** persist each file's
|
||||
externally reachable reference facts beside its declarations, merge them
|
||||
into declaration-to-occurrence postings in `WorkspaceIndex`, and route
|
||||
hover/definition/references through indexed cursor and location lookups.
|
||||
Preserve ambiguity refusals and unsaved open-buffer overlays; prove the
|
||||
indexed answer equals the existing refactor walk before removing that
|
||||
walk from the request path. Release probe: **0.064 ms/request** over 820
|
||||
synthetic files and five returned locations, versus **23.431 ms** for
|
||||
the old walk on the same workspace.
|
||||
|
||||
- [x] `Scope::collect_occurrences` factored out of `collect_edits`, with
|
||||
`collect_edits` rewritten on top of it (no behaviour change; the rename
|
||||
suite is the regression test).
|
||||
- [x] `vlog_refactor::find_references`, new module `references.rs`, 7 tests.
|
||||
- [x] `nav::references` routes through it when the symbol can leave the file.
|
||||
- [x] `nav::references` routes through `WorkspaceIndex` postings when the
|
||||
symbol can leave the file; the refactor walk remains its tested oracle.
|
||||
- [x] `nav::leaves_this_file` — the index-only gate that keeps a local signal
|
||||
off the workspace walk.
|
||||
- [x] `nav::document_highlights` — symbol occurrences in this file.
|
||||
@@ -142,6 +165,42 @@ and none was made.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-08-27 — indexed navigation performance
|
||||
|
||||
- Began replacing the per-request `Workspace::sources()` +
|
||||
`vlog_refactor::find_references` rebuild with reference facts stored in the
|
||||
existing semantic index. The chosen shape is deliberately not a second
|
||||
project model: `FileFacts` remains the per-file persistence and incremental
|
||||
update unit, while `WorkspaceIndex` gains the merged inverted postings.
|
||||
`FACTS_FORMAT` will bump because the persistent record gains fields; the
|
||||
cache's version handshake therefore drops old records rather than reading a
|
||||
partial shape.
|
||||
- Scope remains the scope ladder's decision (filelist exactly when configured,
|
||||
otherwise the folder/workspace setting already in force). This round changes
|
||||
the cost of navigation inside that scope, not which files the user asked the
|
||||
server to index.
|
||||
- Completed the inverted index in the existing `FileFacts` /
|
||||
`WorkspaceIndex` lifecycle. `FACTS_FORMAT` moved from 1 to 2, so an old cache
|
||||
is discarded safely. Incremental save updates rebuild the postings from
|
||||
compact facts already in memory; adding/removing files still follows the
|
||||
index's path-sorted `FileId` contract.
|
||||
- `nav::references` now resolves the live cursor to one indexed declaration,
|
||||
reads its posting list, overlays every open buffer's current semantics, and
|
||||
batches byte-span-to-LSP conversion per touched file. Duplicate declarations
|
||||
and ambiguous uses still fall back to the in-file answer. Permanent tests
|
||||
cover module, package-member and port references, cache round trips,
|
||||
incremental equivalence, ambiguity, unsaved deletions/additions, moved live
|
||||
declarations, and direct equality with `vlog_refactor::find_references`.
|
||||
- Cursor hot paths no longer sweep the whole open file: semantic declaration
|
||||
and reference lookup, plus macro-token hover, use binary-searched position
|
||||
tables. Include definition inspects only the cursor's line.
|
||||
- The ignored release latency probe builds 820 files and returns five
|
||||
locations: **0.064 ms/request** averaged over 200 indexed requests; the old
|
||||
source collection + refactor walk took **23.431 ms** once on the same files
|
||||
(about **366×** slower). Command:
|
||||
`cargo test --release -p lucisv_server
|
||||
qa_indexed_references_latency_over_a_large_workspace -- --ignored --nocapture`.
|
||||
|
||||
### 2026-08-24 — dev agent (M7)
|
||||
|
||||
- **Read first**: `CLAUDE.md`, `docs/features/refactor/README.md`'s triage,
|
||||
@@ -463,6 +522,27 @@ correctness or safety issue in the shipped feature.
|
||||
|
||||
## Review
|
||||
|
||||
**2026-08-27 — lead, indexed-navigation performance round (external dev:
|
||||
codex).** Reviewed the full diff line-by-line and ran all three gates
|
||||
independently (fmt clean, clippy silent, 1155 server tests + workspace
|
||||
suite green). The design keeps the one-project-model rule: reference
|
||||
facts live in `FileFacts` (the existing persistence and incremental
|
||||
unit), postings are merged in `WorkspaceIndex`, and `FACTS_FORMAT` 1→2
|
||||
plus the cache header's format handshake discards every v1 store whole —
|
||||
verified in `index_cache.rs:324`. `macro_definitions` filters
|
||||
`DefineKind::Define`, byte-identical semantics with the
|
||||
`DefineTable::all` it replaces. Ambiguity is preserved everywhere it
|
||||
mattered: ambiguous postings are marked, an ambiguous live overlay use
|
||||
aborts to the in-file answer mid-collection, and the rename refusal
|
||||
contract survives. The equivalence test pins the indexed answer to the
|
||||
old `vlog_refactor::find_references` walk, which stays as rename's
|
||||
engine and the oracle. Lead re-ran the ignored release probe:
|
||||
0.062 ms/request over 820 files vs 21.7 ms for the old walk (~350×),
|
||||
consistent with the work log's numbers. No QA-agent pass this round;
|
||||
the lead review substituted, and the incremental-fingerprint,
|
||||
unsaved-buffer and ambiguity tests cover the paths a QA attack would
|
||||
have targeted. Accepted.
|
||||
|
||||
**2026-08-24 — lead.** Reviewed after QA's ship verdict (clean first
|
||||
pass); gates run independently (1330 tests, 0 failures, clippy silent).
|
||||
The factoring is the right move — `collect_occurrences` peeled out of
|
||||
|
||||
@@ -33,6 +33,7 @@ impl Semantics {
|
||||
// the LSP queries
|
||||
fn symbol_at(&self, offset: u32) -> Option<SymbolId>;
|
||||
fn reference_at(&self, offset: u32) -> Option<&Reference>;
|
||||
fn reference_id_at(&self, offset: u32) -> Option<ReferenceId>;
|
||||
fn definition_of(&self, offset: u32) -> Option<&Symbol>;
|
||||
fn references_of(&self, SymbolId) -> Vec<&Reference>;
|
||||
fn document_symbols(&self) -> Vec<DocumentSymbol>;
|
||||
@@ -362,6 +363,8 @@ anywhere, and under 3 % unresolved on cleanly-parsed files.
|
||||
with their paths
|
||||
- [x] Queries: `symbol_at`, `reference_at`, `definition_of`, `references_of`,
|
||||
`document_symbols`
|
||||
- [x] 2026-08-27: declaration/reference cursor queries use start-sorted
|
||||
position tables and binary search rather than scanning every symbol/use
|
||||
- [x] `Error` nodes are opaque; tolerant trees analyze without panicking
|
||||
- [x] Tests: 19 behavior tests + 6 scanner unit tests + corpus smoke test
|
||||
- [x] TODO.md §6 `vlog_semantic` checkbox
|
||||
@@ -376,6 +379,11 @@ anywhere, and under 3 % unresolved on cleanly-parsed files.
|
||||
|
||||
## Work log
|
||||
|
||||
**2026-08-27 — indexed navigation.** `Semantics` now builds compact sorted
|
||||
`(TextRange, SymbolId/ReferenceId)` position tables with the analysis.
|
||||
`symbol_at`, `reference_at` and `reference_id_at` binary-search those tables;
|
||||
their public answers and half-open span rules are unchanged.
|
||||
|
||||
**2026-08-26 — overlay-promotion dev agent (lead-authorized, cross-module).**
|
||||
`bind.rs` gains `Target::Type`, emitted by `bind_data_type`'s unqualified arm
|
||||
and nowhere else, so pass two can tell a type window from an expression.
|
||||
|
||||
@@ -9,7 +9,9 @@ paths that could finish it — 19.6 % of every use on cleanly-parsed corpus file
|
||||
that finishes them. `WorkspaceIndex::build` scans every file in the workspace
|
||||
once and records what each one *declares* — modules, packages, file-scope
|
||||
typedefs, each package's and module's exported members, and each file's
|
||||
`` `define`` table. `resolve_external` walks one file's external candidates
|
||||
`` `define`` table. Since 2026-08-27 it also records compact reference facts
|
||||
and merges them into declaration-to-occurrence postings. `resolve_external`
|
||||
walks one file's external candidates
|
||||
against that index and answers them in an **overlay** keyed by reference id.
|
||||
That is what turns `import prim_pkg::*` and `prim_fifo_sync u_fifo (...)` into
|
||||
a jump into the file that declares them — TODO.md §6's "cross-file resolution
|
||||
@@ -25,12 +27,15 @@ impl WorkspaceIndex {
|
||||
|
||||
fn files(&self) -> &[PathBuf]; // indexed by FileId
|
||||
fn path(&self, FileId) -> Option<&Path>;
|
||||
fn file_id(&self, &Path) -> Option<FileId>; // 2026-08-27
|
||||
fn units(&self, name: &str) -> &[Def]; // module | package | file-scope typedef
|
||||
fn member(&self, unit: &str, member: &str) -> &[Def];
|
||||
fn members_of(&self, unit: &str) -> impl Iterator<Item = (&str, &[Def])>;
|
||||
fn defines(&self, FileId) -> Option<&DefineTable>;
|
||||
fn instantiations_of(&self, name: &str) -> &[InstantiationEdge]; // 2026-08-27
|
||||
fn subclasses_of(&self, name: &str) -> &[InheritanceEdge]; // 2026-08-27
|
||||
fn references_to(&self, def: &Def) -> &[ReferenceSite]; // 2026-08-27
|
||||
fn references_are_ambiguous(&self, def: &Def) -> bool; // 2026-08-27
|
||||
fn update_file(&mut self, PathBuf, src: &str); // 2026-08-27
|
||||
fn remove_file(&mut self, &Path) -> bool; // 2026-08-27
|
||||
fn fingerprint(&self) -> String; // 2026-08-27
|
||||
@@ -145,6 +150,11 @@ written"). Ambiguity means something else — see below.
|
||||
module stays unreachable, which is correct and is a test.
|
||||
- **`` `define`` tables**: `defines::collect_defines` per file, keyed by
|
||||
`FileId`, read off the same token stream the parse used.
|
||||
- **Reference postings**: uses of the externally reachable declarations above.
|
||||
Each file persists local declaration/use span pairs and unresolved external
|
||||
candidates; after every build or incremental update, the merged declaration
|
||||
tables resolve those compact facts into `DefinitionKey -> [ReferenceSite]`.
|
||||
Ambiguous candidates are marked rather than assigned to a guessed target.
|
||||
|
||||
A declaration whose `name_span` is empty (the single-file layer's "I could not
|
||||
locate this name in the source") is **not** indexed: an editor must never be
|
||||
@@ -407,10 +417,23 @@ and more than half of all external candidates answered on clean files.
|
||||
equal to a whole build; instantiation and inheritance edge tables
|
||||
(`instantiations_of`, `subclasses_of`); `fingerprint` as the equivalence
|
||||
witness
|
||||
- [x] 2026-08-27 (`references-nav` performance): persisted reference facts,
|
||||
declaration-to-occurrence postings, ambiguity markers and indexed macro
|
||||
lookup; reference postings included in the incremental fingerprint
|
||||
- [ ] Deferred (non-goals above): `` `include`` graph, elaboration
|
||||
|
||||
## Work log
|
||||
|
||||
**2026-08-27 — indexed navigation.** `FileFacts` gained compact local and
|
||||
external reference records and its persisted format moved to version 2.
|
||||
`WorkspaceIndex` resolves them into reverse postings after declaration tables
|
||||
are merged, including on an incremental update, without rereading or reparsing
|
||||
other files. The public query is `references_to`; ambiguous external uses are
|
||||
tracked separately so navigation preserves the existing rename refusal. Three
|
||||
focused tests cover postings, incremental/full-build equivalence, and
|
||||
ambiguity, while the record round-trip and corpus acceptance cover persistence
|
||||
and real-source scale.
|
||||
|
||||
**2026-08-26 — overlay-promotion dev agent (lead-authorized, cross-module).**
|
||||
`resolve_external` gained one arm: an `InheritedCandidate`'s paths are tried
|
||||
like an external candidate's, and an entry is recorded only when one lands, so
|
||||
|
||||
Reference in new issue
Block a user