Cross-file references reach a module's nets, variables and instances (§64.1, QA task_d8afe80f of §63.1): nav.rs's two index questions (leaves_this_file, indexed_def_in_file, the latter shared with hover's live_symbol) asked WorkspaceIndex::member — the connection surface, ports and parameters — so a declaration only a hierarchical path can name (a bind connection's expression half, a u_x.sig tail) was judged unable to leave its file and references fell to the single-file answer, while a rename already edited both files; from a use that did resolve cross-file, the declaring buffer's own uses could not re-identify themselves. Both now ask member_in(…, Surface::Hierarchical); the connection answer comes first and whole from that read, so every port/parameter/package/class/struct answer is byte-identical (nav harness controls and a 948-declaration opentitan census). A hierarchical-only member has no Local postings by the §49 ruling, so nav::declaring_file_uses parses exactly the closed declaring file once per request (0.4–1.5 ms on state_q into a shut entropy_src_main_sm.sv), hierarchical_only asking the index's own table rather than restating surface_of. Three QA rounds (Sonnet, Sonnet, then Fable per the escalation rule): the closed-file path read a cached FileView and rendered against a fresh text_of (a stale offset on a wrong line) — now one fresh read per closed file threaded to the rendering step; every index-time span about a closed file, and the open-buffer declaration fallback (nav::declaration_site), guarded by hover::spells_exactly (pub(crate), shared not copied): a stale index may omit a location, never mislocate one. Accepted: +25 % on a local-net references in a 40 267-line buffer (1.22 → 1.54 ms), the guard is textual (a different exact token at a deleted declaration's old bytes). opentitan: entropy_masking_req from aes.sv now lists aes_bind.sv; state_q lists entropy_src_core.sv; checkout untouched. Tests 4422 → 4459 (11 dev + 1 hover + 1 e2e wire test; 19 QA attacks incl. escaped identifiers, UTF-8 boundaries, a deleted declaring file, oracle equivalence with vlog_refactor::find_references); fmt, clippy, workspace suite green through tools/guard.sh. Feature README docs/features/references-hierarchical-surface; references-nav, hierarchical-tail and hover-declarations READMEs, record.rs's postings comment and the topo row amended; perf entry in docs/perf/README.md. Release 0.55.0 left to the owner.
ci / checks (push) Successful in 1m14s
ci / corpus (push) Successful in 36s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-12 14:50:16 -07:00
1 parent 9d1eb1671e
commit a2a22adad8
11 files changed
+3163 -126

No files matched your search

+54 -7
View File
@@ -6860,7 +6860,7 @@ tests (`server/tests/`), `crates/vlog_semantic/src/workspace/hierarchy.rs`
only if `member_in` needs a case it lacks (a Handshake entry either way).
Nothing else.
- [ ] the fixture sweep first, asserting today's answers, then flipped:
- [x] the fixture sweep first, asserting today's answers, then flipped:
`definition`, `references` (from the declaration and from each use,
`includeDeclaration` both ways), `hover`, `documentHighlight` over
(a) a `bind` connection's bare name, (b) a `u_x.sig` tail from an
@@ -6870,19 +6870,66 @@ Nothing else.
— the single-file fallback, as today), (g) an unsaved buffer
(`untitled:`), (h) the open buffer's own in-file use seen from a
cross-file use
- [ ] the fix in both call sites; the §63.1 QA test renamed to say what it
- [x] the fix in both call sites; the §63.1 QA test renamed to say what it
now asserts
- [ ] on the real opentitan tree (read-only): `references` on
- [x] on the real opentitan tree (read-only): `references` on
`entropy_masking_req` from `aes.sv` lists `aes_bind.sv`; on
`state_q` from `entropy_src_main_sm.sv` lists `entropy_src_core.sv`;
the `nav`/`navqueue` harness rows within noise (the hierarchical
lookup is one more map probe)
- [ ] QA: fixtures re-attacked (a generate-scoped net; a net shadowed by a
- [x] QA: fixtures re-attacked (a generate-scoped net; a net shadowed by a
port of the same name in a *different* unit; a class member — must
stay on the connection answer), opentitan census, gates
stay on the connection answer), opentitan census, gates. Verdict:
rework needed — three findings in the closed-declaring-file repair's
handling of a stale-on-disk file (one new to this lane, two
pre-existing and general); see the feature README's QA log.
- [x] rework (dev, per the lead's ruling on QA findings 1–3): one fresh read
per closed file per request, threaded to the rendering step
(`file_view`'s cache is no longer on this path); a re-analysed closed
file's declaration reported at its live span; every index-time
closed-file span guarded with `hover::spells_exactly` (now `pub(crate)`)
and dropped rather than misrendered. `qa_finding_1/2/3` flipped to the
fixed answers and renamed, plus one attack on the guard itself. QA's
+25 % on a local-net request in a 40 000-line file accepted as-is, for
§64.2 to note in `docs/perf/README.md`.
- [x] QA re-check (same worktree): findings 1–3 re-derived by hand and
confirmed fixed (a use-only shift, a deleted declaring file, a UTF-8
boundary, two independent closed files, an escaped port and an
escaped hierarchical net all attacked and held). **Finding 4, new**:
the `include_declaration` fallback's index-time span is rendered with
**no guard** when the file is *open* (only the closed path calls
`spells_exactly`) — reproduced with a renamed live buffer, a stale
3-byte span lands on the first three characters of the live token
`sig2`. Verdict: rework needed again; see the feature README's QA log
for the fix suggestion. Gates green (4453 passed), opentitan
re-confirmed byte-identical, size 423 lines.
- [x] rework 2 (dev, finding 4): the `include_declaration` chain lifted into
`nav::declaration_site`; an open buffer's index-time fallback span is
emitted only if `hover::spells_exactly` holds against the live text,
else the declaration is omitted (the closed path keeps its single guard
in `closed_locations`). QA's finding-4 test flipped and renamed, plus a
control (an unsaved edit above the declaration still reports the live
line). Gates green through `tools/guard.sh`.
- [x] QA final (escalated, same worktree): the finding-4 test re-derived
by hand (a real unsaved rename; honest omission, tails unchanged) and
the control shown to come from the live path; the declaration-site
ladder attacked rung by rung — five `qa_final_*` tests (a failed live
lookup with the name still in place → emitted; a suffix of a longer
live name → dropped; off a UTF-8 boundary → dropped, no panic;
`includeDeclaration: false` on the closed rungs; one observation, a
different exact `sig` at the old bytes is reported, for the lead).
`nav.rs` 433 production lines, no unwrap/expect/panic,
`indexed_references` 71 lines (reported). Gates green (4459 passed),
opentitan rows re-confirmed read-only, checkout status identical.
Verdict: **pass**.
### 64.2 Closing
- [ ] `docs/perf/README.md` note if any harness number moved; topo row
- [x] `docs/perf/README.md` note if any harness number moved; topo row
(`lucisv_server ──▶ vlog_semantic`: nav asks the hierarchical
surface); release 0.55.0 with assets verified
surface) — done 2026-09-12 (the perf entry records the +25 % on a
local-net `references` and the closed-file parse; the
`references-nav ──▶ workspace-index` row amended)
- [ ] release 0.55.0 with assets verified — owner's call; not run from the
`task_d8afe80f` session (a release chain never runs while a lane is
in flight, and the lane merges first)
+40 -1
View File
@@ -455,7 +455,7 @@ fn span_text(text: &str, span: TextRange) -> Option<&str> {
/// to not continue an identifier turns that prefix/suffix match back into a
/// miss, without needing anything more than the same "is this still a name
/// character" question a lexer already answers for `$`, `_` and alnum.
fn spells_exactly(text: &str, span: TextRange, name: &str) -> bool {
pub(crate) fn spells_exactly(text: &str, span: TextRange, name: &str) -> bool {
if span_text(text, span) != Some(name) {
return false;
}
@@ -1313,6 +1313,45 @@ endmodule
let _ = fs::remove_dir_all(&dir);
}
/// TODO §64.1. The same live-span read for a declaration only a
/// **hierarchical** path can reach — a module's internal net, named from
/// another file as `u_leaf.sig`.
///
/// `declaration_snippet` reaches it through `live_symbol` →
/// `nav::indexed_def_for_symbol`, which asked `WorkspaceIndex::member`
/// (the *connection* surface) until §64.1 and so mapped no live symbol
/// back to this `Def` at all: the card came out with its heading and no
/// fence, on a file that was open and perfectly readable. It now shows the
/// live line, which is the same guarantee the port above gets — and the
/// guard is untouched, so a buffer whose live text no longer declares the
/// name still prints nothing (asserted below).
#[test]
fn a_hierarchical_only_declaration_is_read_at_its_live_span_too() {
let top =
"module top;\n leaf u_leaf ();\n wire w;\n assign w = u_leaf.sig;\nendmodule\n";
let saved = "module leaf;\n logic [7:0] sig;\nendmodule\n";
let (dir, mut ws, uri) = included("livehier", &[("leaf.sv", saved), ("top.sv", top)]);
let leaf_uri = path_to_uri(&dir.join("leaf.sv")).expect("uri");
let edited =
"// two lines\n// pushed it down\nmodule leaf;\n logic [15:0] sig;\nendmodule\n";
ws.set_document(leaf_uri.clone(), edited.to_string());
let body = text_of(&hover(&ws, &uri, at(top, "u_leaf.sig") + 7).expect("hover"));
assert!(
body.contains("```systemverilog\n logic [15:0] sig;\n```"),
"the live line, width and all: got {body}"
);
assert!(!body.contains("[7:0]"), "not the saved one: got {body}");
// The guard half, on the same shape: the net renamed away in the
// buffer leaves the heading and no fence.
ws.set_document(leaf_uri, "module leaf;\n logic [15:0] renamed;\nendmodule\n".to_string());
let guarded = text_of(&hover(&ws, &uri, at(top, "u_leaf.sig") + 7).expect("hover"));
assert!(guarded.contains("— declared in"), "today's card, intact: got {guarded}");
assert!(!guarded.contains("```"), "and no snippet at all: got {guarded}");
let _ = fs::remove_dir_all(&dir);
}
#[test]
fn a_stale_indexed_span_drops_the_snippet_rather_than_showing_the_wrong_line() {
// The file changed on disk under a live index — a rescan the server has
File diff suppressed because it is too large. Load diff
+110
View File
@@ -8631,3 +8631,113 @@ fn organize_imports_is_offered_under_its_own_kind_and_runs_as_a_command() {
let _ = std::fs::remove_dir_all(&dir);
}
/// TODO §64.1 over the wire. `leaf` declares an internal net; `top.sv` names it
/// through a hierarchical tail and `leaf.sv` uses it itself. Before §64.1
/// `textDocument/references` answered `leaf.sv`'s two lines from the
/// declaration and never the tail, while `textDocument/rename` at the same
/// position edited both files — lucisv could change a reference it could not
/// list. Asserted here from both ends, with `leaf.sv` the only open buffer, so
/// the tail comes out of the persisted postings and `leaf.sv`'s own use out of
/// the live one; then from `top.sv` with `leaf.sv` closed, where that file's
/// own use is served by one re-analysis of it.
#[test]
fn a_hierarchical_nets_references_and_rename_agree_over_the_wire() {
let dir = temp_dir("hierrefs");
let leaf = dir.join("leaf.sv");
let leaf_text = "\
module leaf (input logic clk_i);
logic sig;
assign sig = clk_i;
endmodule
";
std::fs::write(&leaf, leaf_text).expect("write");
let top = dir.join("top.sv");
let top_text = "\
module top;
leaf u_leaf (.clk_i(1'b0));
wire w;
assign w = u_leaf.sig;
endmodule
";
std::fs::write(&top, top_text).expect("write");
let root = format!("file://{}", dir.display());
let leaf_uri = format!("file://{}", leaf.display());
let top_uri = format!("file://{}", top.display());
// `sig` is declared at line 1 column 8 of `leaf.sv`, used at line 2
// column 9 there, and named at line 3 column 20 of `top.sv`.
let session = [
frame(&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"initialize","params":{{"processId":null,"rootUri":"{root}","capabilities":{{}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#),
frame(WIDE_SCOPE),
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{leaf_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
serde_json::to_string(leaf_text).expect("json")
)),
frame(&format!(
r#"{{"jsonrpc":"2.0","id":2,"method":"textDocument/references","params":{{"textDocument":{{"uri":"{leaf_uri}"}},"position":{{"line":1,"character":8}},"context":{{"includeDeclaration":true}}}}}}"#
)),
frame(&format!(
r#"{{"jsonrpc":"2.0","id":3,"method":"textDocument/rename","params":{{"textDocument":{{"uri":"{leaf_uri}"}},"position":{{"line":1,"character":8}},"newName":"renamed"}}}}"#
)),
// Now from the other side, with `leaf.sv` shut.
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didClose","params":{{"textDocument":{{"uri":"{leaf_uri}"}}}}}}"#
)),
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{top_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
serde_json::to_string(top_text).expect("json")
)),
frame(&format!(
r#"{{"jsonrpc":"2.0","id":4,"method":"textDocument/references","params":{{"textDocument":{{"uri":"{top_uri}"}},"position":{{"line":3,"character":20}},"context":{{"includeDeclaration":true}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","id":9,"method":"shutdown","params":null}"#),
frame(r#"{"jsonrpc":"2.0","method":"exit","params":null}"#),
]
.concat();
let messages = talk(&session);
let response = |id: u32| -> &serde_json::Value {
messages
.iter()
.find(|m| m["id"] == id)
.unwrap_or_else(|| panic!("no response {id} in {messages:#?}"))
};
// Every place naming the net, as `(file, line)`.
let places = |id: u32| -> Vec<(String, i64)> {
let mut out: Vec<(String, i64)> = response(id)["result"]
.as_array()
.expect("a list")
.iter()
.map(|location| {
let uri = location["uri"].as_str().expect("a uri");
let name = uri.rsplit('/').next().unwrap_or("?").to_string();
(name, location["range"]["start"]["line"].as_i64().expect("a line"))
})
.collect();
out.sort();
out
};
let everywhere =
vec![("leaf.sv".to_string(), 1), ("leaf.sv".to_string(), 2), ("top.sv".to_string(), 3)];
assert_eq!(places(2), everywhere, "from the declaration");
assert_eq!(places(4), everywhere, "from the tail, with `leaf.sv` closed");
// And the rename that was already editing both files edits exactly those
// places — the asymmetry §64.1 was filed for, closed from both sides.
let changes = &response(3)["result"]["changes"];
let own = changes[&leaf_uri].as_array().expect("edits for the declaring file");
assert_eq!(own.len(), 2, "{own:#?}");
let elsewhere = changes[&top_uri].as_array().expect("edits for the naming file");
assert_eq!(elsewhere.len(), 1, "{elsewhere:#?}");
assert_eq!(elsewhere[0]["range"]["start"]["line"], 3);
assert_eq!(elsewhere[0]["range"]["start"]["character"], 20);
assert!(elsewhere.iter().all(|e| e["newText"] == "renamed"), "{elsewhere:#?}");
let _ = std::fs::remove_dir_all(&dir);
}
+16 -7
View File
@@ -347,13 +347,22 @@ fn facts_from_analysis(
}
// The **connection** surface only. A `Local` posting exists so that a
// declaration another file can point at carries its own file's uses
// without that file being re-read, and every consumer of the postings
// that matters here — the rename, which re-analyses the declaring file
// anyway — already has them. Posting a module's every internal net use
// would multiply the reference table by the size of an RTL body for an
// answer nothing reads; the hierarchical surface is what a *cross-file*
// tail resolves through, and that half is an `External` fact below.
// See `docs/features/hierarchical-tail/README.md`, "what did not widen".
// without that file being re-read. Posting a module's every internal net
// use would multiply the reference table by the size of an RTL body; the
// hierarchical surface is what a *cross-file* tail resolves through, and
// that half is an `External` fact below.
//
// Two consumers read the postings for a hierarchical-only declaration,
// and each supplies the missing local half by re-analysing that one file:
// a rename (`vlog_refactor`), which re-analyses the declaring file
// anyway, and — since §64.1 — `lucisv_server`'s
// `nav::declaring_file_uses`, which parses exactly the declaring file
// when it is closed and a `references` request arrived from a cross-file
// use. So the narrow table costs one file's parse on one request shape,
// paid by the caller that needs it, instead of a reference table sized by
// every RTL body in the workspace. See
// `docs/features/hierarchical-tail/README.md`, "what did not widen", and
// `docs/features/references-hierarchical-surface/README.md`.
// Which kind lands on which surface is `hierarchy::surface_of`, the one
// rule this filter and the member tables both read (§49's QA asked for
// the pointer).
+20 -4
View File
@@ -128,10 +128,26 @@ The `propagate-ports` engine reads `member`/`members_of` and is untouched.
- **Reference postings.** `facts_from_analysis` records a `Local` posting only
for a use whose declaration is on the **connection** surface. Posting a
module's every internal-net use would multiply the reference table by the
size of an RTL body for an answer nothing reads: the only consumer is a
rename, which re-analyses the declaring file anyway. The *cross-file* half —
the tail in the other file — is an `External` fact, and that is what makes
the rename work.
size of an RTL body. The *cross-file* half — the tail in the other file —
is an `External` fact, and that is what makes the rename work.
**Amended 2026-09-12 (§64.1).** This bullet used to end "for an answer
nothing reads: the only consumer is a rename, which re-analyses the
declaring file anyway". There are two consumers now, and the sentence is
true again only with the second one named: `textDocument/references` reads
the postings too, and since §64.1 it answers for a hierarchical-only
declaration. It is served the way the rename is —
`lucisv_server`'s `nav::declaring_file_uses` parses **exactly the declaring
file, exactly once**, and only when that file has no open buffer and the
request came in from a cross-file use; an open buffer's own uses come from
the live overlay as they always did. Measured on opentitan: `references`
from `u_entropy_src_main_sm.state_q` with `entropy_src_main_sm.sv` closed
costs 1.0–1.5 ms against the 0.1–0.2 ms of the incomplete answer it
replaces, and every connection-surface row of the `nav` harness is
unchanged in both result count and time. So the decision stands, with its
cost now written down: one file's parse on one request shape, instead of a
reference table sized by every RTL body in the workspace. See
`docs/features/references-hierarchical-surface/README.md`.
- **`workspace/symbol`.** An internal net is still not a workspace symbol: the
request answers what a user can name from outside, and a design with 20 000
modules has hundreds of thousands of internal signals.
@@ -142,6 +142,17 @@ The character cap counts `char`s and cuts on a boundary.
## Work log
### 2026-09-12 — dev (§64.1: `spells_exactly` is now `pub(crate)`)
Visibility only, no behaviour change here. `nav.rs` needed the same
agreement check for a closed file's *span* that this feature applies to a
closed file's *snippet* — after §64.1 an index-time `references` span can be
rendered against bytes that moved — and QA's lesson above (a fixed-length
span still spelling the old name as a **prefix** of a longer identifier) is
exactly the case a second copy of the check would have got wrong. So
`hover::spells_exactly` is shared rather than duplicated; see
`docs/features/references-hierarchical-surface/README.md`.
### 2026-08-27 — dev
- Read the brief, `hover.rs`, `nav.rs`, `state.rs` and `convert.rs`. Confirmed
File diff suppressed because it is too large. Load diff
+56 -7
View File
@@ -22,13 +22,35 @@ predicate, and three handlers.
- **The workspace index is the authority on what can be named from another
file.** `nav::leaves_this_file` decides whether a references request walks
the workspace by asking `WorkspaceIndex::units` / `::member` about the name
under the cursor — not by re-deriving `is_unit`/`is_exported`, which are
private to `vlog_semantic` and would be language knowledge in the protocol
layer. Consequence: a declaration the index has not seen yet (a buffer
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`.
the workspace by asking `WorkspaceIndex::units` / `::member_in(…,
Surface::Hierarchical)` about the name under the cursor — not by re-deriving
`is_unit`/`is_exported`, which are private to `vlog_semantic` and would be
language knowledge in the protocol layer. **The surface matters** (amended
2026-09-12, §64.1): the question is which declarations a *use* in another
file can reach, and a hierarchical path may name anything a module declares
(IEEE 1800 §23.6) where a connection list may name only its ports and
parameters (§23.3). Asking `::member` — the connection surface — was what
made `assign w = u_x.sig;` in another file invisible to `references` while
a rename was already editing it. The connection answer is the first, whole
part of the hierarchical one, so nothing else moved; see
`docs/features/references-hierarchical-surface/README.md`. Consequence: a
declaration the index has not seen yet (a buffer 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 stale index can omit a location; it can never point at a wrong one**
(added 2026-09-12, §64.1 rework, QA findings 1–3). Until then this feature's
staleness story stopped at the sentence above, which undersold it: a span
recorded at index time and rendered against a **closed** file's current
bytes — a `references_to` posting, or the `include_declaration` fallback —
had no agreement check, so an external edit to that file (another tool,
`git checkout`, a build step: none of the five events that drop a cached
view) could put a true-looking `Location` on a line that no longer holds the
name. `nav::closed_locations` now applies `hover::spells_exactly` to every
closed-file span before emitting it and drops the ones that no longer spell
the target's name — the same guarantee `hover-declarations` gives a snippet.
Open buffers are not guarded and pay nothing: their spans come from the very
text they are rendered against.
- **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
@@ -230,6 +252,33 @@ decision.
## Work log
### 2026-09-12 — dev (TODO §64.1: the gate asks the hierarchical surface)
`leaves_this_file` and `indexed_def_in_file` — this feature's two index
questions — asked `WorkspaceIndex::member`, the **connection** surface. Since
`hierarchical-tail` (0.45.0) a module's net, variable and instance live on the
**hierarchical** surface only, so both functions judged such a declaration
unable to leave its file: `references` from the declaration fell to the
single-file answer and never saw a cross-file `u_x.sig` tail or a `bind`
connection expression, and a request that *did* go cross-file could not
re-identify the declaring buffer's own in-file uses. Both now ask
`member_in(owner, name, Surface::Hierarchical)`. Every connection-surface
answer is byte-identical (the connection records come first and whole from
that read); the `nav` harness rows are unchanged in count and within noise in
time. The closed-declaring-file half of the completeness problem, the new
`nav::declaring_file_uses`, the fixture sweep and the attack cases are all
written up in `docs/features/references-hierarchical-surface/README.md`, which
is this change's feature README. `documentHighlight`'s "a document answer even
for a cross-file name" assumption was untouched and is now pinned from both
ends (`definition_and_document_highlight_over_a_hierarchical_tail_are_unchanged`).
**Rework the same day**, on QA's findings 1–3: the closed-file path reads each
closed file exactly once per request, with `text_of` rather than the
`file_view` cache, and every index-time span about a closed file is guarded by
`hover::spells_exactly` before it is rendered. That is the new Assumptions
bullet above; the derivation and the flipped QA tests are in
`docs/features/references-hierarchical-surface/README.md`.
### 2026-08-28 — documentHighlight answered nothing on a cross-file name
**The report.** `performance.md` §7: `documentHighlight` returned 0 results at
+33
View File
@@ -1390,3 +1390,36 @@ is read for comments), `analyze` (9.4 ms), `resolve_external` (4.7 ms),
and ~6 ms dropping the previous revision's products on the request path.
`docs/features/perf-first-after-edit/README.md`; evidence
`~/.cache/lucisv-perf/63-2/`.
### 2026-09-12 — loop 3, round 2 (TODO §64)
**§64.1 is a correctness lane, not a performance one**, recorded here
because it moves one harness row on purpose. `textDocument/references`
now judges a declaration's cross-file reach on the **hierarchical**
surface (`nav::leaves_this_file` / `indexed_def_in_file` ask
`member_in(…, Surface::Hierarchical)` instead of `member`), so a module's
net, variable or instance — which a `bind` connection or a `u_x.sig`
tail names from another file — is answered workspace-wide instead of
silently in-file. Two costs, both measured on the real opentitan tree:
- **A local net's `references` in a 40 267-line open buffer** now walks
the indexed path (two map probes plus the name-prefiltered pass over
open buffers) instead of returning the in-file answer directly:
**1.22 → 1.54 ms median** (QA, throwaway worktree at 9d1eb16 for the
before). Accepted: the gate still saves the walk for every name the
index holds nowhere.
- **A cross-file request into a *closed* declaring file** (the shape that
used to answer incompletely) parses exactly that file once, fresh from
disk: 0.1–0.2 ms → **0.4–1.5 ms** on `state_q` from
`entropy_src_core.sv` with `entropy_src_main_sm.sv` shut — the price
of the in-file uses that answer used to omit. The index deliberately
posts no `Local` reference for a hierarchical-only member (the §49
ruling: a reference table sized by every RTL body for a rarely-asked
answer), so the one-file re-analysis is the same trade the rename
already makes.
Every connection-surface row of the `nav` harness is unchanged in result
count and within noise in time (`aes` 14 locations / 9 files, `.clk_i`
12 / 9). Every closed-file span is now guarded by `hover::spells_exactly`
before it is rendered — one slice compare per location, unmeasurable —
so a stale index can omit a location but never point at a wrong line
(QA findings 1–4). `docs/features/references-hierarchical-surface/README.md`.
+1 -1
View File
@@ -628,7 +628,7 @@ engine-lane features are listed above; this table is the server-internal web.
| `on-type-formatting ──▶ range-formatting, editor-scopes` | depends | `;` goes through `format::range_formatting` unchanged; `\n` answers indent only, computed from `pairs.rs`'s own keyword tables (three items widened to `pub(crate)`) — one reader's answer for "what opens a scope". |
| `interactive-latency ──▶ change-debounce, editor-scopes, selection-range, on-type-formatting, completion-core, inline-templates` | depends | Round 2 of the perf work (`docs/perf/README.md`). It measures the flush change-debounce coalesces and the round trip it defers, and it replaces one token *sweep* with one token *binary search* in `selection.rs`, `on_type.rs`, `completion.rs` and `inline.rs`. No answer moved — each swap is pinned against the sweep it replaced at every byte — so none of those five features' contracts changed; what they now share is `state.rs`'s two search primitives and the ordering property of `tokenize`'s output they rest on. |
| `interactive-latency ◀──▶ lucisv-server` | handshake | Two free functions, `first_token_reaching` and `first_token_from`, are published from `state.rs` beside `Document::token_at`; that is where the monotonicity argument every caller depends on is written down, and `state::tests::the_token_stream_rises_and_never_overlaps` is the test that fails first if `vlog_parser` ever breaks it. `tests/e2e.rs`'s `Live::finish` now returns its publish count (existing callers ignore it), and `perf::generated_module` has a copy in `tests/e2e.rs` — a binary crate's modules are unreachable from an integration test — which must stay the same shape as the original. |
| `references-nav ──▶ workspace-index / hover-line-index` | depends | Cross-file references resolve an indexed target first and consume declaration postings directly; same-file local references stay on `Semantics`. Locations use the shared `FileView`. `documentHighlight` now also follows the document's external overlay for names declared elsewhere, fixing the old “references works, highlight is empty” split without widening highlights beyond the current file. |
| `references-nav ──▶ workspace-index / hover-line-index` | depends | Cross-file references resolve an indexed target first and consume declaration postings directly; same-file local references stay on `Semantics`. Since §64.1 (2026-09-12) the two index questions (`leaves_this_file`, `indexed_def_in_file`) ask `member_in(…, Surface::Hierarchical)`, so a module's net/variable/instance named by a `bind` connection or a `u_x.sig` tail is answered workspace-wide; a hierarchical-only declaration in a *closed* file has no `Local` postings, so `nav::declaring_file_uses` parses exactly that file once per request. Every closed-file span and the open-buffer declaration fallback are guarded by `hover::spells_exactly` (now `pub(crate)`): a stale index may omit a location, never mislocate one. Locations for closed files are rendered from one `text_of` read per file per request (not the `FileView` cache, whose entry could differ from the same request's re-analysis). `documentHighlight` now also follows the document's external overlay for names declared elsewhere, fixing the old “references works, highlight is empty” split without widening highlights beyond the current file. |
| `selection-range / linked-editing ──▶ spans, name-spans` | depends | Pure arrangements of existing ranges; linked-editing's table documents exactly which constructs carry both spans (and which verbatim ones can't — `program`, property/sequence, covergroup). |
| `type-definition ──▶ nav / overlay-promotion / ansi-first-port` | depends + 2 delivered handshakes | Now literally `nav::definition` at the type name's offset; both of its filed requests landed (§2.2, §2.5). |
| `hierarchy ◀──▶ inlay-hints` | handshake (shared walk) | The instantiation walk was lifted out of `inlay.rs` into a shared module (now `vlog_semantic::instantiations`) rather than copied — the two answers cannot drift; inlay's 34 tests are the regression net. |