TODO section 18. Typing a dot used to get the whole-index dump (every keyword and project word, capped at 512); now the answer after a separator is exclusively the members of what precedes it, or nothing. The prefix walk is published from vlog_semantic as MemberSite / Semantics::member_site / WorkspaceIndex::members_of_chain and the resolver's own member_of, unit_member, member_in_chain and follow_one are rewritten to call it - one walk, so the popup cannot list a member hover would not resolve (pinned structurally). Inherited members ride the same base chain; this./super./pkg::/cls:: are the same question. A headless dot inside an instantiation's (...) or #(...) lists the module's ports or parameters through signature.rs's own list detector and the Target::Port walk, already-connected ports dropped. Trigger characters '.' and ':'. Measured cheaper than the dump it replaces (6-62 us vs 212 us). QA's finding fixed at the root: the binder had discarded ParamPort.kw and bound every localparam as Param, so #(. offered prim_fifo_sync's DepthW. SymbolKind::LocalParam, keyword sticky across continuation entries as instantiate::params reads it, exported wherever Param is, 'localparam' on the hover card, excluded from the override list only. FACTS_FORMAT 9 -> 10. Also carried: TODO sections 19 and 20 (the escaped-identifier and constraint-body plans) and the topo rows for both lanes. Co-Authored-By: Claude Fable 5 <[email protected]>
956 lines
58 KiB
Markdown
956 lines
58 KiB
Markdown
# member-completion
|
||
|
||
## Goal
|
||
|
||
`item.` / `reg2hw.ctrl.` / `vif.` / `vif.cb.` / `pkg::` / `this.` / `super.`
|
||
list **members**. Until this round the cursor after a dot got the whole-index
|
||
dump — the scope tier, the index tier, 181 keywords and every identifier the
|
||
project uses, capped at 512 and marked `isIncomplete` — because
|
||
`completion.rs` had no notion of a `.` at all. This round gives the separator
|
||
a meaning: with one, the answer is the members of the site the head resolves
|
||
to **and nothing else**, and an unresolvable head answers *nothing* rather
|
||
than a guess. The one dot with no head in front of it that is still a real
|
||
question — the `.` that opens a connection or a parameter override inside
|
||
`sub u (…)` / `sub #(…)`, which is the commonest completion position in RTL
|
||
there is — answers with that module's **ports** or **parameters**.
|
||
|
||
The governing rule is inherited from the three member-resolution rounds this
|
||
builds on (class-member-access rounds 1–2, interface-semantics,
|
||
struct-members): **one resolution walk.** Completion lists exactly what hover
|
||
and go-to-definition would resolve, because it calls the same functions. The
|
||
split is structural, not a promise kept by discipline:
|
||
|
||
| the resolution | = | the site walk | + | one lookup |
|
||
|---|---|---|---|---|
|
||
| `resolve::member_of(from, head, mids, name)` | | `Semantics::member_site(from, head, mids)` | | `member_in_chain(site, name)` |
|
||
| `resolve::unit_member(from, unit, name)` | | `Semantics::unit_site(from, unit)` | | `lookup_local(name)` |
|
||
| `resolve::member_in_chain(scope, name)` | | `Semantics::member_scopes(scope)` | | `lookup_local(name)` per scope |
|
||
| `workspace::member_chain(unit, name)` | | `WorkspaceIndex::members_of_chain(unit)`'s hops | | `index.member(hop, name)` per hop |
|
||
| `workspace::follow_one(name, path)` | | `fold_path(path)` (shared) | | `member_chain(unit, name)` |
|
||
|
||
Each right-hand column is the left-hand function's own body after the
|
||
refactor. There is no second resolver to disagree with the first, and
|
||
`crates/vlog_semantic/tests/member_site.rs` re-derives each resolution from
|
||
its own prefix to keep it that way.
|
||
|
||
## Assumptions
|
||
|
||
- **A separator makes the answer exclusive.** After a `.` or a `::` a member
|
||
name is the only thing that may be written, so a keyword, a template, a
|
||
module name or a project word is not a *worse* candidate there — it is a
|
||
wrong one. This is the backtick ruling (completion-core, *The backtick
|
||
ruling*) applied to the other two spellings that admit exactly one kind of
|
||
name.
|
||
- **An unresolvable head answers nothing, and nothing is the right answer.**
|
||
A dot the user has just typed is a commitment; a list that ignores it and
|
||
offers the whole workspace is noise that trains people to stop reading the
|
||
popup. Every stopping condition is `vlog_semantic`'s own, unchanged: an
|
||
untyped head, a type this file declares as something with no members, a
|
||
chain link that cannot be taken honestly.
|
||
- **The spine is read from the buffer's *bytes*, not from a parse.** The
|
||
cursor after a `.` is usually in a buffer that does not parse — that is
|
||
what half-typed code is — so the head is found by scanning backwards over
|
||
identifier characters, `.`, and balanced `[…]`. What that reads and what it
|
||
refuses is listed under *The spine parser* below. It is the same
|
||
head/mids pair `bind.rs::spine` builds from the AST for a complete
|
||
expression, and the two agree on every shape both can read.
|
||
- **A method inserts its bare name.** No `()`, no snippet, no argument
|
||
tabstops: the call is the user's to write, and a completion that invented
|
||
parentheses would be guessing at whether this is a call, an assignment of a
|
||
method handle, or a `randomize() with` clause. Same rule as every other
|
||
plain item in this file.
|
||
- **The detail card never reads a file.** One rule with two halves: a member
|
||
of the **buffer being typed in** shows its own declaration line, which is
|
||
free and is what tier 1 has always shown (`input logic [WIDTH-1:0] data,`
|
||
is the whole of what a connection list needs to know); a member the
|
||
**index** holds shows the kind label plus the declared type name, which is
|
||
all a `Def` carries, because reading the declaring file on a keystroke is
|
||
the one thing no answer here may do (completion-core, *Every tier is a
|
||
table lookup*). The asymmetry is the point: each half is the best answer
|
||
available on its own side.
|
||
- **`vif.cb.` lists the enclosing interface's signals.** A clocking block
|
||
declares no scope of its own and carries the interface as its `type_name`
|
||
(interface-semantics, 2026-09-01), which is what makes `vif.cb.data`
|
||
resolve to the interface's `data`. The list is therefore the interface's —
|
||
wider than the block's own item list, never wrong about a name, and exactly
|
||
what the resolution walks. Narrowing it would mean a second answer.
|
||
- **An unpacked array head answers nothing.** `item_c q[4]; q[0].` lists
|
||
nothing, because `bind.rs::declare_typed` deliberately records no
|
||
`type_name` for an unpacked declarator — `q` names a container, and `q.size()`
|
||
is an array method rather than a member of `item_c`. Completion may not mint
|
||
a type the resolver refuses to mint. A **packed** array head is indexed away
|
||
and does work (`hdr_t [3:0] hs; hs[1].`). Filed below.
|
||
- **A `.` with no head is a connection or an override, or it is nothing.**
|
||
The only other place a dot stands with nothing readable before it is inside
|
||
a construct this cannot parse backwards, and there the answer is silence.
|
||
The list is `signature.rs`'s own (`enclosing_list`), so the popup after the
|
||
dot and the signature card above it can never disagree about which module
|
||
is being instantiated, and the dot must stand *directly* in the list —
|
||
inside `.clk( … )` the parentheses do not balance and an expression is what
|
||
may be written.
|
||
- **A connection list is filtered to what may legally be written in one.** A
|
||
module scope also binds its nets, its instances and its variables; a
|
||
`.internal_sig(w)` connection is not legal and class-member-access already
|
||
ruled that a module exports its ports and parameters and nothing else. The
|
||
kind filter is that ruling applied to the in-file half, where the scope is
|
||
unfiltered — it never offers a name the resolution could not find, it
|
||
declines to offer names it should not.
|
||
- **A header `localparam` is not an override, and the keyword is the only
|
||
place that fact lives.** `parameter int Depth = 4, localparam int DepthW =
|
||
$clog2(Depth)` declares two constants a module exports alike and only one an
|
||
instantiation may override. Until 2026-09-02 `vlog_semantic` bound both as
|
||
`SymbolKind::Param` (`bind.rs` never read `ParamPort::kw`, which the parser
|
||
had always carried), so a `#(.` list offered `DepthW` — QA finding 1, on
|
||
`prim_fifo_sync`. The fix is at the root: [`SymbolKind::LocalParam`], bound
|
||
from the keyword, which is **sticky** — a continuation entry inherits the
|
||
one before it, the same rule `vlog_refactor::instantiate::params` has always
|
||
applied. Everything else treats the two alike, deliberately and explicitly:
|
||
see *Every `SymbolKind::Param` site* under Handshakes.
|
||
- **Ports already connected in the same list are dropped.** The friendlier
|
||
half of a choice whose other half would be simpler: in a sixty-port
|
||
instantiation the fifty-five already wired are precisely what the user is
|
||
not looking for. It cannot mislead — a dropped name is one the buffer
|
||
spells two lines up — and the entry being *re-typed* stays on offer, because
|
||
the dot the cursor follows is the one `connected_names` skips.
|
||
- **`this`/`super` are heads even though the binder never sends them as
|
||
ones.** `bind.rs` routes `this.x` and `super.x` to `Target::ThisMember` /
|
||
`SuperMember`, which resolve one member and stop; a `this.` popup asks the
|
||
same question about the same class, so it is answered from the same walk
|
||
(`resolve::head_site`) rather than from a second one. `super` names the
|
||
first hop of the `extends` chain: the base's scope when this file declares
|
||
it, the base's *name* when it does not — which is the unit the overlay's own
|
||
chase starts at.
|
||
|
||
## Handshakes
|
||
|
||
**Widened in `vlog_semantic`** — public API only, no behaviour change, and
|
||
`FACTS_FORMAT` stays **9** (no census, no record layout, nothing the index
|
||
cache reads):
|
||
|
||
- `MemberSite { Scope(ScopeId), Unit(String) }` (new, `model.rs`). `Unit` is
|
||
the composed path spelling `follow_one` already consumes (`pkt_t`,
|
||
`pkt_t::hdr`) — not a new vocabulary, the existing one made public.
|
||
- `Semantics::member_site(from, head, mids) -> Option<MemberSite>` — the
|
||
prefix of `resolve::member_of`, which now calls it.
|
||
- `Semantics::unit_site(from, path) -> Option<MemberSite>` — the prefix of
|
||
`resolve::unit_member`, which now calls it (via `unit_scope`). A `pkg::cls`
|
||
path descends afterwards on `type_here`'s terms.
|
||
- `Semantics::member_scopes(scope) -> (Vec<ScopeId>, Option<String>)` — the
|
||
walk of `resolve::member_in_chain`, which now calls it (as `extends_chain`).
|
||
- `WorkspaceIndex::members_of_chain(path) -> Vec<(&str, &Def)>` — every
|
||
member a path can name, inherited and aliased ones included, one `Def` per
|
||
name from the nearest unit on the chain. `members_of` was `pub` and
|
||
uncalled; it omits inherited members, which is the gap this closes. It
|
||
stays as it is and is now this function's inner loop.
|
||
- `WorkspaceIndex::member_unit(unit, member) -> Option<String>` — the old
|
||
private `member_type`, renamed and made public. `follow_one` calls it
|
||
through the shared `fold_path`.
|
||
|
||
- `Semantics::instantiable_scope(name) -> Option<ScopeId>` — the module or
|
||
interface scope this file declares, which is literally the call
|
||
`resolve`'s `Target::Port` arm makes (`owning_scope(…, is_instantiable)`,
|
||
both now `pub(crate)`). A connection list's completion and a `.port`
|
||
resolution look in one scope, found one way.
|
||
|
||
**Widened in `vlog_semantic`, round 2 (2026-09-02, QA finding 1)**:
|
||
`SymbolKind::LocalParam` is a new variant, bound by `bind.rs` from the
|
||
declaration's keyword in all three places one is written (the `#( … )` header,
|
||
an item-level `localparam`, a block-level one). `FACTS_FORMAT` **9 → 10**: an
|
||
older store records every localparam as a `param`, which is not a label
|
||
difference but a wrong answer, and an older reader has no name for the new
|
||
kind — so the bump is needed in both directions. `resolve::owning_scope` and
|
||
`is_instantiable` became `pub(crate)`.
|
||
|
||
### Every `SymbolKind::Param` site, and what it decided
|
||
|
||
The variant is not `#[non_exhaustive]`, so the compiler named every `match`;
|
||
the `matches!` sites were found by grep and are listed here so nothing is
|
||
"decided by omission".
|
||
|
||
| site | decision |
|
||
|---|---|
|
||
| `bind.rs` header / item / stmt `ParamDecl` | **the fix** — keyword decides, sticky |
|
||
| `facts.rs` `kind_name` / `kind_of` / round-trip | new name `localparam`; `FACTS_FORMAT` 9 → 10 |
|
||
| `workspace.rs::is_exported` (package/class, module, interface) | **exported wherever `Param` is** — `u_fifo.DepthW` is legal and resolved before this round, and still does |
|
||
| `symbols.rs::kind_label` | `"localparam"` — the hover heading now agrees with the snippet under it |
|
||
| `symbols.rs::lsp_kind` | `CONSTANT`, as `Param` |
|
||
| `tokens.rs` semantic token | `Highlight::Parameter`, as `Param` |
|
||
| `completion.rs::completion_kind` | `CONSTANT`, as `Param` |
|
||
| `completion.rs` `#(.` override list | **`Param` only** — this is what the fix buys |
|
||
| `vlog_refactor::ports::visible_in` | visible, as `Param` — a localparam is a name in scope |
|
||
| `vlog_refactor::instantiate::params` | **already correct** and already pinned: it reads the AST keyword, which is what `bind.rs` should have been doing. Now pinned *against* the completion list, so the popup and the ghost skeleton name one set |
|
||
| `type_def.rs` | reads the AST (`ParamDecl`/`ParamPort`), never the kind — `typeDefinition` on a localparam's type works exactly as on a parameter's, which is right |
|
||
| `resolve.rs` `Target::Port` | unchanged and kind-agnostic: `.DepthW(1)` written in source still resolves to the localparam it names. An illegal override is the compiler's complaint; answering nothing would be the worse lie. Pinned |
|
||
|
||
**Widened in `lucisv_server::signature`** (2026-09-02 rework):
|
||
`enclosing_list`, `List` and `Kind` became `pub(crate)`. Nothing about what
|
||
they compute changed, and `signature_help` is byte-for-byte the same answer.
|
||
`completion.rs` asks the identical question — which module's `(…)` or `#(…)`
|
||
is the cursor in — so the popup after the dot and the signature card above it
|
||
cannot disagree; a second answer to that would eventually drift.
|
||
|
||
**Requested of the lead — `docs/topo.md` is stale.** Its
|
||
`member-completion ◀──▶ …` row (written at the first review) ends "No facts
|
||
change." That was true then and is not now: QA finding 1's fix bumps
|
||
`FACTS_FORMAT` **9 → 10**, and the row should also name `vlog_refactor` and
|
||
`lucisv_server::{symbols, tokens, hover}` among the touched files, since
|
||
`SymbolKind::LocalParam` reached them. `topo.md` is not this lane's file, so
|
||
this is filed rather than edited.
|
||
|
||
**Requested of nobody else.** `vlog_parser` and `vlog_linter` are untouched;
|
||
`vlog_refactor` took one `matches!` arm (`ports::visible_in`) and
|
||
`lucisv_core` nothing. `server.rs` is untouched: it
|
||
already discards the request's `context`, and the handler decides from the
|
||
buffer.
|
||
|
||
**Promised to `lucisv_server`'s callers**: `completions` still never panics,
|
||
and every item still carries a `textEdit` replacing exactly the typed word —
|
||
which after a separator is the (possibly empty) run of characters between it
|
||
and the cursor, never the separator itself.
|
||
|
||
**Behaviour change, stated loudly**: the whole-index dump after a `.` is
|
||
gone, and every place that felt it gained a better answer rather than
|
||
silence — a member access gets its members, a connection list gets the
|
||
module's ports, a parameter override gets its parameters. What is left with
|
||
no answer at all is the set of shapes nothing can honestly answer: a call, a
|
||
cast, an unresolvable head, a module the workspace does not declare.
|
||
|
||
**Amended in `docs/features/completion-core/README.md`**: the tier table gains
|
||
the member row, and the "Every other tier ignores position entirely" sentence
|
||
is corrected — a separator is now the second thing a response reads position
|
||
for, and unlike tier 0's gate it does not merely *withhold* items, it decides
|
||
the whole shape of the answer.
|
||
|
||
## The spine parser
|
||
|
||
`typed_word` already trimmed identifier characters back from the cursor and
|
||
already produced an empty word with an empty replace range right after a
|
||
separator, which is the correct edit shape. What is new is that it now looks
|
||
at the bytes *before* that run.
|
||
|
||
`::` is checked before `.`, so a lone `:` — a case item, a block label, a
|
||
ternary — is not a separator at all and falls through to the ordinary six
|
||
tiers exactly as it always did.
|
||
|
||
**What the dot spine reads**: identifiers joined by `.`, each optionally
|
||
carrying balanced `[…]` index suffixes, which are stripped. `this` and
|
||
`super` are ordinary identifiers to it.
|
||
|
||
**What it refuses, answering `None` — no popup rather than a guess**:
|
||
|
||
| shape | why |
|
||
|---|---|
|
||
| `f().b` | a call's return type is not modelled |
|
||
| `pkg::cls.` | a unit is not a value; `member_site` resolves its head lexically |
|
||
| `a . b` | legal SystemVerilog nobody writes; accepting it means deciding where an expression ends by scanning arbitrary text backwards |
|
||
| `1.` | an identifier run may not start with a digit — that is a real literal |
|
||
| `}.`, `).`, `'{...}.` | a concatenation, a cast, an assignment pattern |
|
||
| `a[b.` | an unbalanced `]` scan |
|
||
|
||
The `::` head reads one identifier, or several joined by `::` (`pkg::cls`),
|
||
and nothing else.
|
||
|
||
**A dot with no head at all** — `sub u (.`, `.clk(clk), .`, `sub #(.` — is
|
||
not a failure. It is the connection-list question, and it is answered by
|
||
`connection_members` rather than by a site walk. Every *other* no-head dot
|
||
answers `None`.
|
||
|
||
## The `isIncomplete` rule
|
||
|
||
VS Code asks the server again on the next keystroke **only** when the last
|
||
answer said it was incomplete; otherwise it filters the list it already holds.
|
||
The member answer's rule:
|
||
|
||
| typed after the separator | matched by | `isIncomplete` |
|
||
|---|---|---|
|
||
| nothing | everything — the whole member list | only if the cap truncated |
|
||
| 1–2 characters | prefix | **always** |
|
||
| 3 or more | subsequence (`candidates::Query`) | only if the cap truncated |
|
||
| *any*, and the list came out **empty** | — | **always** (QA finding 2) |
|
||
|
||
The 0-character row is the one that matters, because it is the request the
|
||
trigger character fires: the answer is the *whole* list, so it is complete,
|
||
and VS Code then filters it client-side with its own subsequence matcher —
|
||
which is precisely the behaviour this feature wants, delivered by the client
|
||
for free.
|
||
|
||
**Deviation from the brief, argued.** The brief said a complete member list at
|
||
0–2 typed characters is complete, on the grounds that the 2→3 trap does not
|
||
apply within a bounded member list. It does apply at 1–2: a prefix-filtered
|
||
answer is a strict subset that the third keystroke *widens* to a subsequence
|
||
match, which is the same shape as the main path's trap and has the same
|
||
consequence — the widening would never reach the client. So 1–2 characters
|
||
say incomplete, and only the 0-character answer (which really is the whole
|
||
list) is complete. `only_a_filtered_answer_below_the_fuzzy_floor_is_incomplete`
|
||
pins all four rows.
|
||
|
||
The rule is the same for a connection list, which is a bounded member list of
|
||
the same kind: the bare `.` that the trigger fires answers with every port
|
||
still to wire and is complete; `.d` is a prefix slice and is not.
|
||
|
||
The last row is QA's finding 2 turned into a rule. An empty answer is never a
|
||
satisfying final one, and one particular emptiness is *transient*: a cold
|
||
index whose scope ladder has not widened to the declaring file's directory yet
|
||
answers empty for one request and correctly for the next. Marked complete, VS
|
||
Code caches the emptiness and the user has to retype the dot to see anything.
|
||
Marked incomplete, the next keystroke picks up the real list. It costs one
|
||
extra request in exactly the case where a request is cheapest — there was
|
||
nothing to build.
|
||
|
||
The other half of the same rule: a resolved site whose filter matches nothing
|
||
answers with an **empty list**, not with `None`. `None` carries no
|
||
`isIncomplete` and so cannot ask the client to come back — the popup would
|
||
die at `item.zz` and never revive at `item.zzz`. `Items::into_list` exists for
|
||
exactly that, beside `Items::finish`, whose `None` keeps its own meaning
|
||
("this was not my question") for the tiered answer.
|
||
|
||
## The tier digit
|
||
|
||
Member items are filed under `'0'`, the same digit as tier 0. Not a
|
||
contradiction: the member answer is exclusive, so no other tier's item is ever
|
||
in the same response, and the digit orders members among themselves and
|
||
nothing else. `'0'` because these are not one tier of an answer but the whole
|
||
of it; a sixth digit would claim there is a ranking against the other tiers to
|
||
express, and there is not.
|
||
|
||
The **array** order is separate from `sortText`, and it is nearest-first only
|
||
across the boundary that matters: every member this file declares comes before
|
||
every member the index supplies, in `member_scopes` chain order within the
|
||
in-file half. The index half is **one alphabetical block**, because
|
||
`members_of_chain` dedups nearest-first (which is what correctness rests on:
|
||
the `Def` listed for a name is the `Def` a lookup finds) and *then* sorts by
|
||
name for a stable answer. So if a member list ever truncated at `LIMIT`, what
|
||
it would drop is the alphabetically-late end of the cross-file half — **not**
|
||
the most distant base's members, which two or more hops of inheritance would
|
||
have interleaved by name long before the cap. Stated because an earlier
|
||
version of this file claimed the latter (QA doc note, 2026-09-02); nothing in
|
||
the code changes, and a 512-item member list has not been observed.
|
||
|
||
## Performance
|
||
|
||
Measured over the 860-file corpus (picorv32, ibex, common_cells, OpenTitan),
|
||
against `uart_reg_pkg`'s real generated register struct. Worst of ten, after a
|
||
warm-up round, aarch64-apple-darwin.
|
||
|
||
| request | items listed | release | debug |
|
||
|---|---:|---:|---:|
|
||
| `reg2hw.` (`uart_reg2hw_t`) | 11 | **7.8–18 µs** | 49–79 µs |
|
||
| `reg2hw.ctrl.` (through the synthesized key) | 9 | **6.4 µs** | 36–38 µs |
|
||
| `uart_reg_pkg::` | 74 | **49–62 µs** | 253–257 µs |
|
||
| `uart_core (.` — a connection list | 16 | **6.9 µs** | 46 µs |
|
||
|
||
For scale, the tiered answer at an empty prefix over the same corpus is
|
||
212 µs (completion-core). The member answer is *cheaper* than the answer it
|
||
replaces, and by a wide margin: it is one `member_site` walk over one file's
|
||
scopes plus one `BTreeMap` range scan per unit on the chain, where the tiered
|
||
answer scans three whole-workspace tables. Nothing here reads a file.
|
||
|
||
The connection-list row is measured, not assumed: `enclosing_list` walks the
|
||
tokens before the cursor once, `connected_names` walks the list once, and the
|
||
list itself is one `BTreeMap` range scan (across files) or one file-scope
|
||
lookup and a scope scan (in-file). Ranges are given because two runs a minute
|
||
apart differ by that much on a loaded laptop; the shape of the answer is that
|
||
every one of these is tens of microseconds.
|
||
|
||
The permanent guard is
|
||
`completion::tests::a_member_request_over_the_whole_corpus_stays_in_budget`,
|
||
which skips when `corpus/` is not checked out and asserts the same
|
||
deliberately loose 150 ms its sibling asserts — there to catch an order of
|
||
magnitude, not to pin a number.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] `MemberSite` + `Semantics::member_site` / `unit_site` / `member_scopes`,
|
||
each the extracted prefix of the resolution that now calls it
|
||
- [x] `WorkspaceIndex::members_of_chain` / `member_unit`; `member_chain` and
|
||
`follow_one` refactored onto the shared `base_chain` / `fold_path`
|
||
- [x] `Word` learns `sep` and `spine`; the dot and `::` spine parsers
|
||
- [x] The exclusive member answer, prefix- then subsequence-filtered
|
||
- [x] `trigger_characters: [".", ":"]`, the two `main.rs` pins updated
|
||
- [x] **Connection and parameter lists** (lead ruling, rework): `.` inside
|
||
`sub u (…)` lists the ports, `#(.` the parameters, in-file through
|
||
`instantiable_scope` and across files through the index's member table,
|
||
already-connected names dropped, `signature.rs`'s list detection reused
|
||
- [x] Tests: `crates/vlog_semantic/tests/member_site.rs` (31), the member and
|
||
connection-list sections of `completion.rs`'s unit tests (43, one of
|
||
them corpus-gated against the real `prim_fifo_sync`), two e2e round
|
||
trips over the wire, and eight pre-existing expectations flipped to the
|
||
more correct kind or label
|
||
- [x] **`localparam` is its own `SymbolKind`** (QA finding 1, rework):
|
||
bound from the keyword with the sticky continuation rule;
|
||
`FACTS_FORMAT` 9 → 10; every `Param` site decided explicitly; a `#(.`
|
||
list offers `Param` only, pinned against `instantiation_plan` and
|
||
against the real `prim_fifo_sync` header in the corpus
|
||
- [x] An empty member answer is always `isIncomplete` (QA finding 2)
|
||
- [x] Corpus timings, and the regression guard beside the existing one
|
||
- [x] `completion-core`'s tier table and its position sentence amended
|
||
|
||
## Filed, not done (for the lead)
|
||
|
||
- ~~**Connection-list port completion.**~~ **Done in this lane** on the
|
||
lead's ruling of 2026-09-02 — see the rework entry in the work log. What is
|
||
*not* done there and is worth a line: a **wildcard** `.*` list offers
|
||
nothing special (the ports it implies are already connected by it), and an
|
||
**ordered** connection list gets no help at all, because a positional
|
||
connection has no name to complete.
|
||
- **An unpacked array head.** `item_c q[$]; q[0].` answers nothing because
|
||
`bind.rs` records no `type_name` for an unpacked declarator (TODO.md §15's
|
||
round-2 note says so explicitly). Giving completion an answer means giving
|
||
the *resolver* one — an element type for an indexed head — which is a
|
||
`bind.rs` decision, not this lane's. `q[i].x` hover and definition are
|
||
silent today for the same reason, so completion is not ahead of them by
|
||
guessing; it is silent with them.
|
||
- **`pkg::cls::` across files.** A composed `::` path hops through
|
||
`member_unit`, which reads a member's *declared type*; a class has none, so
|
||
a cross-file `pkg::cls::` lists nothing. `follow_one` has exactly the same
|
||
gap for `pkg::cls::x` resolution today, so the two agree — but both are
|
||
missing an answer a UVM workspace would like. In-file it works
|
||
(`unit_site` descends through the container scopes).
|
||
- **A cross-file member's documentation, and its declaration line.** In the
|
||
buffer being typed in both are free and the card shows the line; across
|
||
files a `Def` carries no text, so the card is a kind label plus a type name
|
||
and a doc comment is out of reach. Both want a file read, so both belong
|
||
behind `completionItem/resolve`, which the server currently and
|
||
deliberately advertises as `None`. Turning it on is a real design change —
|
||
every item would need an identity to resolve by — and is worth its own
|
||
round.
|
||
|
||
## Work log
|
||
|
||
### 2026-09-02 — dev
|
||
|
||
Read the brief, TODO §18, completion-core (the tiers, the table-lookup rule,
|
||
the fuzzy amendment, the `isIncomplete` trap), fuzzy-completion,
|
||
class-member-access, interface-semantics, struct-members, and the five source
|
||
files this lane owns.
|
||
|
||
**The one-walk refactor came out better than the brief's shape**, and this is
|
||
the round's main design decision. The brief proposed pinning `member_site` +
|
||
`member_in_chain` against `member_of` with a test. A test that re-implements
|
||
the tail arm is tautological once `member_of` *is* the prefix plus the tail,
|
||
so the extraction was pushed one level further instead: `member_in_chain`
|
||
itself was split into `extends_chain` (the walk) plus a `lookup_local` per
|
||
scope, and `member_chain` into `base_chain` (the hops) plus an `index.member`
|
||
per hop. Completion then consumes the *walks*, not copies of them, and the
|
||
tests pin the properties that are not tautological:
|
||
|
||
- `every_in_file_member_that_resolves_is_a_name_the_site_offers` — for every
|
||
`head….member` in a mixed fixture, the declaration the resolution names is
|
||
one of the names the site offers.
|
||
- `a_site_that_leaves_the_file_is_the_resolutions_path_minus_the_tail` — the
|
||
`MemberSite::Unit` path is byte-for-byte the resolution's own
|
||
`ExternalCandidate` path with `::<name>` cut off.
|
||
- `every_listed_member_is_the_def_a_lookup_of_that_name_finds` — for every
|
||
name `members_of_chain` lists, `member_chain` finds that same `Def`.
|
||
- `the_innermost_scope_at_the_cursor_answers_the_same_site` — the server has
|
||
only an offset, not a reference, so the two ways of naming the scope have
|
||
to agree.
|
||
|
||
**Deviations from the brief, each argued where it lives:**
|
||
|
||
1. **`isIncomplete` at 1–2 typed characters** is `true`, not `false`. See
|
||
*The `isIncomplete` rule* — the brief's claim that the 2→3 trap does not
|
||
apply inside a bounded member list holds for the 0-character answer (which
|
||
is the whole list) and fails for a prefix-filtered one. Pinned four ways.
|
||
2. **A resolved site with no matching member answers an empty list**, not
|
||
`None`, so the response can carry the `isIncomplete` that brings the
|
||
client back. `Items::into_list` added beside `Items::finish`.
|
||
3. **`Semantics::scope_at` was not added.** The brief marked it optional.
|
||
`completion::innermost_scope` is its only would-be caller and already
|
||
exists; lifting it would be a second spelling of a function with one user,
|
||
which *Simplicity first* rules out. The property that matters — that the
|
||
innermost scope answers the same site the binder's scope does — is pinned
|
||
as a test instead of enforced by a shared function, because the two are
|
||
asking genuinely different questions (a span search versus a recorded
|
||
field).
|
||
4. **`member_scopes` returns a tuple**, not a named struct. House style
|
||
(`resolution_counts`, `ExternalResolutions::counts`) and one call site.
|
||
5. **`unit_chain` became `base_chain`** — the hops *past* the head rather than
|
||
including it — purely for lifetimes: the head is the caller's own string
|
||
and need not outlive the index. It also removes an allocation from the hot
|
||
`member_chain` path for the common unit that extends nothing, where the old
|
||
`visited` vector always pushed once.
|
||
6. **`vif.cb.` lists the interface's members.** Discovered, not designed: a
|
||
clocking block carries the enclosing interface as its `type_name` and opens
|
||
no scope. Following the resolver is the rule, so the list follows it.
|
||
7. **`q[i].` works only for a packed head.** The spine parser strips indices as
|
||
the brief asked; the *semantic* layer then declines an unpacked declarator
|
||
because it records no type for one. Filed rather than worked around — the
|
||
alternative is completion minting a type hover does not have, which is the
|
||
second resolver this round exists to prevent.
|
||
|
||
**No new setting.** This is what a member list does everywhere; a toggle would
|
||
be a setting whose off position is the whole-index dump nobody wants.
|
||
`settings.rs` and `package.json` untouched, as the brief's file list requires.
|
||
|
||
### 2026-09-02 — dev, rework on the lead's ruling
|
||
|
||
The lead ruled the connection-list regression **rework-class, not a
|
||
follow-on**: `.` inside `sub u (…)` is the single most common RTL completion
|
||
position and the round may not ship it as silence. Done in this lane.
|
||
|
||
`member_answer`'s dispatch now reads: a spine → the site walk; **no** spine
|
||
and a `.` → `connection_members`; no spine and a `::` → nothing. The new
|
||
function is three borrowed decisions and no new judgement:
|
||
|
||
1. **Which list.** `signature::enclosing_list`, lifted to `pub(crate)` with
|
||
`List`/`Kind`. It already answers "which module's `(…)` or `#(…)` is the
|
||
cursor in" for the signature card that hangs directly above this popup, and
|
||
two answers to that would drift. Nothing about what it computes changed.
|
||
The dot must also stand *directly* in the list, which is `balanced` — the
|
||
helper tier 0's gate already uses — over the tokens since the `(`.
|
||
2. **Which scope.** `Semantics::instantiable_scope`, added as
|
||
`resolve::owning_scope(…, is_instantiable)` — literally the call
|
||
`Target::Port` makes. In-file it is the whole answer and the index is never
|
||
asked, exactly as the resolution has it; across files it is
|
||
`members_of(module)`, which is what `member_chain` reads for the same use
|
||
(a module has no base, so the chain is one hop).
|
||
3. **Which kind.** `Port` for a `(…)` list, `Param` for a `#(…)` one. A
|
||
module scope also binds nets and instances, and class-member-access
|
||
already ruled that `.internal_sig(w)` must not resolve; this is that ruling
|
||
applied to the in-file half, which is otherwise unfiltered. It narrows to
|
||
what is legal — it never offers a name the resolution could not find.
|
||
|
||
**Already-connected ports are dropped** (`connected_names`), which the lead
|
||
left to argue. Filtering wins on the shape that matters: sixty ports,
|
||
fifty-five wired, and the five left are the whole of what the popup is for.
|
||
The two ways it could be wrong are both closed — the entry being *re-typed* is
|
||
still offered, because its own dot is the one the scan skips, and a name
|
||
dropped here is one the buffer already spells a few lines up, so nothing is
|
||
hidden that is not visibly present.
|
||
|
||
**Two shapes stayed distinct**, and the distinction is the same one the site
|
||
half already draws: a `.` in **no** instantiation list answers `None` ("this
|
||
was not a question I can read"), and a `.` in a list whose module nothing
|
||
declares answers an **empty list** ("this was the question, and there is
|
||
nothing"). Never the dump, either way.
|
||
|
||
**One detail rule changed while I was there**, and it is an improvement worth
|
||
naming: a member of the buffer being typed in now shows its own declaration
|
||
line (`declaration_detail`, tier 1's card) rather than a kind label. For a
|
||
port that is `input logic [WIDTH-1:0] data,` — the direction and the width,
|
||
which is the whole of what a connection list needs — and for a class property
|
||
it is `rand bit [7:0] addr;` rather than "variable". The cross-file half is
|
||
unchanged and still table-only, because a `Def` carries no text. One pin was
|
||
flipped (`the_kind_and_the_detail_come_off_the_declaration`) and one added for
|
||
the other half (`a_cross_file_member_shows_the_kind_label_and_its_declared_type`).
|
||
|
||
**Tests added**: eleven in `completion.rs` — the regression itself (`.cl`
|
||
inside `sub u (` lists `clk`), a bare `.` at the list's start, after a comma,
|
||
after a comma and an indented newline, `#(.` for parameters, a module in
|
||
another file, an interface instance, a non-ANSI port list, an already-connected
|
||
port dropped and a re-typed one kept, the 1–2/3 filter rule, a module the
|
||
workspace does not declare, a `.` inside a connected expression, and a `.` in
|
||
no list at all — plus one e2e round trip driving the `.` trigger inside a real
|
||
port map, a partly-wired list and a `#(.` override.
|
||
|
||
**On the gate count.** The lead was right to query the 2 674/29 figure
|
||
reported before this rework: it was an **undercount**, and the cause was the
|
||
counting, not the running. It was read out of a `tee`d log at a moment when
|
||
only 29 of the run's 40 `test result:` lines had reached the file — the cargo
|
||
process had exited, but the count was taken from a partially flushed log. This
|
||
run was watched to completion (`EXIT=0` written by the shell after cargo
|
||
returned) and counted both ways, so the arithmetic can be checked rather than
|
||
trusted:
|
||
|
||
- **40** test binaries launched (`Running` + `Doc-tests` lines)
|
||
- **40** `test result:` lines — every binary reported
|
||
- **2 879 passed, 0 failed, 38 ignored**; zero `FAILED`/`error` lines
|
||
|
||
After the QA rework below the same command, counted the same way, gives
|
||
**40 / 40, 2 887 passed, 0 failed, 38 ignored**, exit 0 — the eight new pins
|
||
(3 in `member_site.rs`, 5 in `completion.rs` including the corpus-gated
|
||
`prim_fifo_sync` reproduction) on top of the 2 879.
|
||
|
||
The 38 ignored are the corpus-gated tests (34 in `lucisv_server`, 2 in `e2e`,
|
||
1 each in `interfaces.rs` and `member_access.rs`), unchanged by this lane. The
|
||
difference from the lead's 2 810 baseline is this lane's own tests: 28 in
|
||
`member_site.rs`, 38 in `completion.rs`, 2 e2e, 1 in `main.rs`.
|
||
|
||
**Gates**: `cargo fmt --all -- --check` clean; `cargo clippy --all-targets
|
||
--workspace` zero warnings; `cargo test --workspace` green; `cargo build -p
|
||
lucisv_server` + `node editors/vscode/smoke.js target/debug/lucisv-server` →
|
||
`smoke: OK`. Exact counts in the rework entry below. Nothing was written under
|
||
`corpus/opentitan` — the corpus probes overlay a buffer that is not on disk,
|
||
the same trick the existing keystroke probe uses.
|
||
|
||
### 2026-09-02 — dev, QA round: the `localparam` split
|
||
|
||
QA passed everything in this lane bar one finding (15 opentitan probes, zero
|
||
strangers, zero whole-index dumps, ≤ 0.25 ms). The finding was
|
||
**REWORK-class** and the lead extended this lane's ownership to fix it at the
|
||
root rather than at the symptom.
|
||
|
||
**The finding.** `#(.` on `prim_fifo_sync`
|
||
(`hw/ip/uart/rtl/uart_core.sv:185`) offered `DepthW`, declared
|
||
`localparam int DepthW = $clog2(Depth)` inside the header
|
||
(`hw/ip/prim/rtl/prim_fifo_sync.sv:21`) and illegal to override.
|
||
|
||
**The root cause was not in this lane's new code.** `bind_param_ports`
|
||
(`bind.rs`) bound every `#( … )` entry as `SymbolKind::Param` regardless of
|
||
`ParamPort::kw`, which the parser has always carried and which
|
||
`vlog_refactor::instantiate::params` has always read. The two layers
|
||
disagreed, and nothing before this round asked the question that made the
|
||
disagreement visible. Body `localparam`s were bound as `Param` too, as the
|
||
lead suspected — checked and fixed in the same three-line change.
|
||
|
||
**The fix, at the root**: `SymbolKind::LocalParam`, bound from the keyword in
|
||
all three places one may be written, with the **sticky** rule (a continuation
|
||
entry inherits the keyword before it) that `instantiate::params` already
|
||
applied — so the two now agree because they read the same field the same way.
|
||
`FACTS_FORMAT` 9 → 10, because an older store calls every localparam a
|
||
`param` and that is a wrong answer rather than a stale label.
|
||
|
||
**Every site that matched `Param` decided explicitly** — the table under
|
||
Handshakes. The shape of the decision, everywhere: a localparam *is* a
|
||
parameter for reading (exported by the same units, same LSP kind, same
|
||
highlight, same completion icon, and `u_fifo.DepthW` still resolves) and is
|
||
*not* one for overriding. The one behavioural difference is the `#(.` list.
|
||
Two labels improved as a side effect: hover now says **localparam** over a
|
||
localparam, where it used to say "parameter" directly above a snippet reading
|
||
`localparam WIDTH = 8;`.
|
||
|
||
**Six pre-existing test expectations flipped**, every one of them to a *more*
|
||
correct value, each with a comment saying why: `classes.rs` ×2,
|
||
`semantics.rs` ×2, `workspace.rs` ×2 (the last two are now the strongest pin
|
||
that a package `localparam` is still exported and still resolves across
|
||
files), `hover.rs` ×2.
|
||
|
||
**Pins added**: `member_site.rs` ×3 — the keyword decides and carries forward
|
||
(header, continuation, re-declared `parameter`, body); a localparam is still
|
||
exported and `member`/`members_of_chain` still answer for it; an override
|
||
written against a localparam still names it. `completion.rs` ×4 — the
|
||
opentitan shape in-file, the same across files, the override list and
|
||
`instantiation_plan` pinned against each other, and the empty-answer rule
|
||
below.
|
||
|
||
**QA finding 2 — not a defect, and now documented.** A cold first
|
||
cross-directory request answered an empty list before the folder-scope widen
|
||
landed, then answered correctly. That is `index-scope`'s documented ladder,
|
||
not this lane's behaviour, and the member answer's empty list is the right
|
||
*shape* for it. What was worth changing is one bit: an empty answer is now
|
||
always `isIncomplete`, so the client comes back on the next keystroke instead
|
||
of caching the emptiness until the user retypes the dot. See *The
|
||
`isIncomplete` rule*.
|
||
|
||
**QA's doc-only note** — the truncation-order claim under *The tier digit* was
|
||
wrong for two or more cross-file hops, because `members_of_chain` sorts by
|
||
name after deduping nearest-first. Reworded; no code changed.
|
||
|
||
## QA log
|
||
|
||
### 2026-09-02 — QA (restarted after a rate-limit termination)
|
||
|
||
A prior pass on this feature was cut off before anything was recorded (empty
|
||
QA log, no scratch survived). This entry redoes the full checklist from the
|
||
brief, top to bottom, independently of the lead's own numbers.
|
||
|
||
**Gates, run to completion and counted twice.**
|
||
|
||
- `cargo fmt --all -- --check`: clean.
|
||
- `cargo clippy --all-targets --workspace`: zero warnings, exit 0.
|
||
- `cargo test --workspace`, watched to completion and `grep -c "^test result:"`
|
||
against the tee'd log: **40** test binaries, **40** `test result:` lines,
|
||
**2 879 passed / 0 failed / 38 ignored**, zero `FAILED`/`error` lines, exit
|
||
0 — matches the lead's figures exactly.
|
||
- `cargo build --release -p lucisv_server`: clean.
|
||
- `node editors/vscode/smoke.js target/release/lucisv-server`: `smoke: OK`,
|
||
and the trigger-character assertion added this round (`.`/`:`) is present
|
||
and passing.
|
||
|
||
**Scope.** `git diff --stat master` matches the file list in this README's
|
||
Handshakes exactly: `vlog_semantic::{lib,model,resolve,workspace}.rs` +
|
||
`tests/member_site.rs` (new), `lucisv_server::{completion,main,signature}.rs`
|
||
+ `tests/e2e.rs`, `editors/vscode/smoke.js`, `docs/topo.md` (one new edge
|
||
line), this README (new) + `completion-core`'s amendment, `TODO.md`.
|
||
`vlog_parser`, `vlog_refactor`, `bind.rs`, `inline.rs`, `settings.rs`,
|
||
`package.json` all diff empty against master, confirmed by
|
||
`git diff --stat`. `FACTS_FORMAT` is still `9` (`facts.rs:62`, untouched).
|
||
`grep` for `.unwrap()`/`.expect(`/`panic!` in the diff's added lines finds
|
||
hits only inside `#[cfg(test)] mod tests` blocks (`completion.rs:1690`
|
||
onward, `main.rs`'s test module) — none in a library code path.
|
||
|
||
**Attack set.** Eleven temporary tests were added to
|
||
`completion.rs`'s existing `mod tests` (compiled and run with
|
||
`cargo test -p lucisv_server completion::tests::qa_`, then the file was
|
||
restored byte-for-byte to the dev's diff — `git diff --stat` on it now reads
|
||
back exactly `1148 insertions(+), 3 deletions(-)`, the same as before this
|
||
pass touched it):
|
||
|
||
- **Precedence** (`.clk(item.` where `item` resolves): the spine path wins
|
||
over the connection-list path even though the cursor is textually inside
|
||
`sub u (...)` — answers `item`'s members (`user_id`), never the port list.
|
||
This is the case the existing `a_dot_inside_a_connected_expression_...`
|
||
test under-covers, because its head is deliberately unresolvable and so
|
||
both paths would answer `None` regardless of which one runs first.
|
||
- **A base two hops up**, both hops in different files from the subclass:
|
||
content is right — the middle class's override of a shared name wins and
|
||
appears once — but this surfaced a **documentation inaccuracy** (below),
|
||
not a wrong member.
|
||
- **A four-deep struct chain** (`x.b.c.d.` through four `typedef struct
|
||
packed` layers): resolves to exactly the innermost field.
|
||
- **`pkg::cls::` across files** (the documented gap): answers an **empty
|
||
list** (`[]`), not `None` and not a dump — safe on both counts.
|
||
- **A `.` inside a string** whose preceding bytes spell a valid spine
|
||
(`"item.")`): answers `None`, because the comment/string gate in
|
||
`completions()` runs before the word/separator is even parsed.
|
||
- **A connection list nested inside a `generate` block**: still resolves to
|
||
the instantiated module's own port.
|
||
- **A wildcard `.*` list and an ordered/positional list**: neither is
|
||
specially filtered (documented, filed as "not done"), and neither produced
|
||
a stranger — every name offered was a real port of the module in both
|
||
cases.
|
||
- **The interface handle's exact member set** (`vif.` over the `MEMBERS`
|
||
fixture): `cb, clk, data, mp` — no stranger, checked by `assert_eq!` rather
|
||
than the existing test's `contains`.
|
||
|
||
All eleven passed; no wrong member, no dump, in any of them.
|
||
|
||
**One documentation finding (informational, not REWORK — no wrong member, no
|
||
dump).** "The tier digit" section claims a truncated member list always
|
||
drops "the most distant base's members" first. That holds for an in-file
|
||
`extends` chain (`member_scopes`, declaration order) but **not** once the
|
||
chain crosses a file boundary at two or more hops:
|
||
`WorkspaceIndex::members_of_chain` (`workspace.rs`) sorts its *whole* union
|
||
alphabetically by name regardless of which hop a name came from. In the
|
||
two-hop attack test, the surviving override (`shared`, correctly kept from
|
||
the nearer of two files) sorts *after* the far base's own `grand_only`, so a
|
||
cap would drop the nearer hop's override before the distant base's name —
|
||
the opposite of what the section promises. The dedup itself (nearest wins,
|
||
each name once) is correct; only the claimed truncation order is inaccurate
|
||
for a chain with 2+ cross-file hops. Filed for the lead; not blocking.
|
||
|
||
**Opentitan probes.** Read-only, `git -C opentitan status --porcelain`
|
||
before and after: unchanged, only the three pre-existing dirty files
|
||
(`hw/ip/aes/dv/tb/tb.sv`, `hw/top_darjeeling/.../ast.sv`,
|
||
`hw/top_earlgrey/.../ast.sv`). Driven over real stdio LSP (release server,
|
||
`--verbose`, `rootUri` = the opentitan root) with a hand-rolled Node client
|
||
mirroring `smoke.js`'s framing — never a bare `lucisv <path>`. Every buffer
|
||
is the real file's content, either used as-is (cursor placed right after an
|
||
existing separator already in the source — legitimate, since completion
|
||
only reads bytes *before* the cursor) or edited in memory via `didOpen`
|
||
only; nothing was written to disk. 15 probes, all with the trigger context
|
||
`{triggerKind: 2, triggerCharacter: "."}` or the `::` equivalent:
|
||
|
||
| position | file | list size | strangers? | timing (warm) |
|
||
|---|---|---:|---|---:|
|
||
| `item.` → `act_item.` (`uart_item`, retested after warm-up) | uart_scoreboard.sv | 5 | none — exact match to the 5 `rand` fields | 0.05 ms |
|
||
| `cfg.` (parameterized `CFG_T` field) | uart_scoreboard.sv | **None** | n/a — documented: an unresolvable parameterized-generic head, consistent with the resolver's own limit | 0.02 ms |
|
||
| `reg2hw.` | uart_core.sv | 11 | none — exact match to `uart_reg2hw_t`'s 11 fields | 0.07 ms |
|
||
| `reg2hw.ctrl.` | uart_core.sv | 9 | none — exact match to `uart_reg2hw_ctrl_reg_t` | 0.07 ms |
|
||
| `hw2reg.status.` | uart_core.sv | 6 | none — sibling fields only, matches real RTL usage | 0.07 ms |
|
||
| `cfg.vif.` (2-hop through a parameterized `cfg`) | tl_host_driver.sv | **None** | n/a — propagates from `cfg`'s own unresolvable type | 0.01 ms |
|
||
| `cfg.vif.host_cb.` (3-hop) | tl_host_driver.sv | **None** | n/a — same propagation | 0.02 ms |
|
||
| `tlul_pkg::` | uart.sv | 38 | none | 0.14 ms |
|
||
| `uart_reg_pkg::` | uart_core.sv | 74 | none — matches the feature README's own measured figure exactly | 0.25 ms |
|
||
| `this.` (absent `uvm_sequence_item` base) | tl_seq_item.sv (edited copy) | 42 | none — 23 real fields + real methods + the probe's own injected member; no constraint names leaked in | 0.15 ms |
|
||
| `uart_core (.` half-wired (10 of 14 ports connected, edited copy) | uart.sv | 4 | none — exactly the 4 left unconnected | 0.04 ms |
|
||
| `#(.` bare, `prim_fifo_sync` | uart_core.sv | 5 | **see finding below** | 0.07 ms |
|
||
| `#(.` on the same instance, 3 of 6 params connected (edited copy) | uart_core.sv | 4 | **see finding below** | 0.05 ms |
|
||
| `vif.` (raw `tl_if` handle, in-file) | tl_monitor.sv (edited copy) | 15 | none — exactly 7 signals + 5 modports + 3 clockings | 0.10 ms |
|
||
| `item.` cold (first-ever cross-directory request, before this session's docs sample) | uart_scoreboard.sv | 0 | see finding below (informational) | 0.04 ms |
|
||
|
||
Every non-`None` list above was cross-checked against the declaring file's
|
||
own text and matched exactly, with two exceptions:
|
||
|
||
**Finding 1 — REWORK-class, real wrong member, high real-world frequency.**
|
||
`#(.` on `prim_fifo_sync` (`hw/ip/uart/rtl/uart_core.sv:185` and `:286`)
|
||
offers `DepthW` alongside the five real `parameter`s. `DepthW` is declared
|
||
`localparam int DepthW = prim_util_pkg::vbits(Depth+1);` **inside** the same
|
||
`#( ... )` header (`hw/ip/prim/rtl/prim_fifo_sync.sv:21`) — a `localparam`
|
||
cannot legally be overridden in an instantiation's `#(.name(...))` list, so
|
||
offering it there is exactly the failure this feature's own connection-list
|
||
ruling forbids ("filtered to what may legally be written in one"). Root
|
||
cause: `vlog_semantic::bind::bind_param_ports` (`bind.rs:481-489`) binds
|
||
**every** entry of a `#(...)` header as `SymbolKind::Param`, parameter and
|
||
localparam alike, even though the AST already distinguishes them
|
||
(`vlog_parser::ast::ParamPort.kw: Option<String>` — `"parameter"` vs.
|
||
`"localparam"`) — the information needed to fix this is already parsed and
|
||
simply unused at the bind site. This is not a regression in this diff's own
|
||
files: `bind.rs` is untouched by this lane (confirmed by the scope diff),
|
||
and the one-walk promise holds — completion mirrors what the resolver
|
||
already (mis)classifies, faithfully, so a hand-written `.DepthW(...)` would
|
||
presumably resolve as a param too. But it is a real, user-visible defect
|
||
that this feature is the first to *expose* (the old whole-index dump masked
|
||
it), and it is common: **79 files** under `hw/ip/*/rtl/*.sv` alone declare a
|
||
`localparam` inside a `#(...)` header (`grep` count, opentitan). Filed for
|
||
the lead: the fix belongs in `bind.rs::bind_param_ports`, reading `p.kw` to
|
||
either skip a `localparam` entry or give it a kind the connection-list
|
||
filter excludes — outside this lane's stated file scope, so not fixed here.
|
||
|
||
**Finding 2 — informational, not a wrong member or a dump; a cold-cache
|
||
timing note.** The very first cross-directory member request issued against
|
||
a freshly started server (`item.` → `act_item.`, `uart_scoreboard.sv`,
|
||
before any other file had been opened) answered an **empty list** for a
|
||
type (`uart_item`) that does have 5 fields. Re-running the *identical*
|
||
request later in the same session, after other probes had caused the
|
||
workspace to widen its cache (~2 170 files, logged as `cached: ...` lines),
|
||
answered the correct 5 fields exactly. This reproduced once, consistently,
|
||
and only as the session's first cross-file request; it is not a wrong
|
||
member (nothing spurious was offered) and not a dump — it is an empty
|
||
answer where a fuller one exists, self-healing on the very next equivalent
|
||
request. It looks like a lazy-indexing race that predates this feature
|
||
(`server.rs`/`state.rs`, both untouched by this diff) rather than anything
|
||
in `completion.rs`'s own logic, and a real editor session normally sends
|
||
`workspaceFolders` and issues several other requests (hover, diagnostics)
|
||
before a user reaches for `.` completion, which is likely why this has not
|
||
been reported before. Noted for whoever owns workspace warm-up; not
|
||
blocking this lane.
|
||
|
||
**One doc fix made directly** (small, unambiguous, per the QA remit):
|
||
`docs/features/completion-core/README.md`'s prose paragraph right after the
|
||
freshly-amended tier table still said "Tier 4 deliberately includes names
|
||
that are not visible at the cursor" — stale after this round's table fix
|
||
added the template row and pushed keyword to 4 and word to 5. Changed to
|
||
"Tier 5". (The two *dated log* references to the old numbering, in the
|
||
Status/TODO checklist and an earlier QA entry, were left alone — they are
|
||
historical records of what was true when they were written, not live
|
||
documentation.)
|
||
|
||
**Verdict: REWORK**, scoped narrowly. Everything about the **member**
|
||
half of this feature (class/struct/interface chains, packages, `this`/
|
||
`super`, cross-file inheritance, the spine parser's refusals, the
|
||
`isIncomplete` rule, detail cards, precedence over connection lists) is
|
||
correct, exact, and dump-free — dev and lead should not need to touch any
|
||
of it. The **connection/parameter-list** half is correct except for
|
||
Finding 1, which is REWORK-class per the brief's own bar (a name offered
|
||
that may not legally be written there) and not a narrow edge case in this
|
||
codebase (79 real files hit it in one directory alone). Recommended fix is
|
||
a small, out-of-lane change to `bind.rs::bind_param_ports` (read `p.kw`),
|
||
which this lane should either take as a rework (as it did for the
|
||
connection-list ruling itself) or hand to the lead to route.
|
||
|
||
### 2026-09-02 — QA re-verification of the `localparam` rework
|
||
|
||
Re-ran the full checklist against the dev's rework rather than trusting the
|
||
work-log entry's description of it.
|
||
|
||
**Gates, re-run and counted independently.** `cargo fmt --all -- --check`
|
||
clean; `cargo clippy --all-targets --workspace` zero warnings; `cargo test
|
||
--workspace` watched to completion — **40 binaries, 40 `test result:`
|
||
lines, 2 887 passed / 0 failed / 38 ignored**, zero `FAILED`/`error` lines,
|
||
exit 0, matching the dev's figures exactly (net +8 over the prior pass's
|
||
2 879, and the arithmetic holds: `member_site.rs` gained 3 pins,
|
||
`completion.rs` gained 4, plus the empty-answer pin — no test was silently
|
||
dropped to make a flipped assertion look like a wash). `cargo build
|
||
--release -p lucisv_server` clean; `smoke.js` → `smoke: OK`.
|
||
|
||
**The original reproduction, live over the wire, both shapes.** Rebuilt the
|
||
release server and re-ran the exact `prim_fifo_sync #(.` position from
|
||
Finding 1 (`hw/ip/uart/rtl/uart_core.sv:185`, the retype position with
|
||
`Pass`/`Depth` already wired) — now `NeverClears, OutputZeroIfEmpty, Secure,
|
||
Width`, `DepthW` gone. Also built the fully-bare shape (a synthetic
|
||
`#(.)` instantiation in an edited copy of the same file, nothing connected)
|
||
to match the exact list named in the re-verification brief: **`Depth,
|
||
NeverClears, OutputZeroIfEmpty, Pass, Secure, Width`** — six items, no
|
||
`DepthW`, exact.
|
||
|
||
**Three more real `#(.` sites, three different IPs, none touched by the
|
||
first pass** (all read-only, real files, cursor placed at an existing
|
||
separator or an edited in-memory copy — nothing written to disk):
|
||
|
||
| site | IP | connected already | offered | localparam correctly excluded |
|
||
|---|---|---|---|---|
|
||
| `usbdev_counter #(.` (`usbdev.sv:1333`) | usbdev | `NEndpoints`, `NEvents` | `NEndpoints, Width` | `EpW` — yes |
|
||
| `spid_fifo2sram_adapter #(.` (`spi_tpm.sv:1343`) | spi_device | all 6 real params | `SramBaseAddr` (retyped) | `FifoPtrW` — yes |
|
||
| `tlul_socket_1n #(.` (`hmac_reg_top.sv:107`) | hmac (via tlul) | all 10 real params | `ExplicitErrs` (retyped) | `NWD` — yes, the *only* other candidate there is the localparam, so this is the sharpest possible check |
|
||
|
||
Every list cross-checked against the declaring file's own header. Zero
|
||
strangers, zero dumps, all ≤ 0.10 ms warm. Hover on `prim_fifo_sync`'s own
|
||
`DepthW` declaration: `**localparam** \`DepthW\`` over
|
||
`` localparam int DepthW = prim_util_pkg::vbits(Depth+1) `` — heading and
|
||
snippet agree, in 0.06 ms. `git -C opentitan status --porcelain` before and
|
||
after: unchanged, the same three pre-existing owner files.
|
||
|
||
**The sticky rule, attacked directly** (five temporary tests added to
|
||
`completion.rs`'s `mod tests`, run, then the file restored byte-for-byte —
|
||
`git diff --stat` on it reads back exactly what it was before this pass
|
||
touched it): a header with **two** parameter/localparam runs
|
||
(`parameter A, B, localparam C, D`) splits 2/2 correctly, not just the
|
||
single-run shape the dev's own pin covers; a `localparam` inside a
|
||
`generate` block body binds `LocalParam`; a synthetic **interface** header
|
||
localparam binds `LocalParam` too (no real opentitan interface in the
|
||
sampled set uses the idiom, so this was built rather than found — `bind_module`
|
||
sharing one AST node and one `bind_param_ports` call across
|
||
module/interface/program means this was never a separate code path to
|
||
begin with, and the test confirms that structural argument rather than
|
||
resting on it). Class localparam and cross-file `pkg::LP` were already
|
||
pinned by the dev (`classes.rs:70,728`, `workspace.rs:104,143`) and were
|
||
read, not re-litigated.
|
||
|
||
**The empty-answer `isIncomplete` rule**, attacked on the two shapes named
|
||
in the brief: a memberless class's member list and an unknown module's
|
||
connection list both answer `{items: [], isIncomplete: true}` — not `None`,
|
||
not `isIncomplete: false`. Both temporary tests passed.
|
||
|
||
**Index equalities.** `state::tests::the_incremental_update_agrees_with_a_
|
||
whole_rebuild_over_the_real_corpus` (not `#[ignore]`d — it was already inside
|
||
the 2 887) run in isolation for its own output: **172 corpus files copied,
|
||
6 sampled and mutated five ways each** (unchanged, a declaration+edge added,
|
||
replaced wholesale, emptied, removed), `update_one_checked` comparing the
|
||
incremental `WorkspaceIndex::fingerprint()` against a full
|
||
`WorkspaceIndex::absorb`-rebuilt one after every mutation — 30 fingerprint
|
||
equalities, all held, after the new `SymbolKind` variant. No corpus store
|
||
delta: the sweep runs in a scratch copy, nothing under `corpus/` itself is
|
||
touched.
|
||
|
||
**No new findings.** The truncation-order rewording, the hover-label fix,
|
||
and the `LocalParam` export parity are all as described in the work log and
|
||
verified independently above, not just read.
|
||
|
||
**Verdict: SHIP.** Finding 1 is closed at the root, live-verified against
|
||
the exact original reproduction plus three independent real-world sites in
|
||
three different IPs the first pass never touched, and the sticky rule holds
|
||
under a harder attack (two runs in one header, a generate-block body, and
|
||
an interface header) than the dev's own single-run pin exercises. Finding 2
|
||
now degrades gracefully (an empty answer always revives on the next
|
||
keystroke) rather than being fixed at its root (a pre-existing, out-of-lane
|
||
indexing-warm-up characteristic, correctly left alone). The doc-only
|
||
truncation-order note is reworded, not just acknowledged. Nothing else
|
||
regressed: 2 887/0/38 across 40 binaries, the corpus fingerprint sweep
|
||
holds, opentitan is untouched.
|
||
|
||
## Review
|
||
|
||
## Review
|
||
|
||
**2026-09-02 — lead.** Approved and committed after two reworks, both of
|
||
which made the round better than the brief.
|
||
|
||
- The one-walk proof is structural, not promised: `member_of`,
|
||
`unit_member`, `member_in_chain` and `follow_one` are each rewritten as
|
||
their site walk plus one lookup, and the pins assert the non-tautological
|
||
half (a name the popup offers is a name hover resolves; a cross-file site
|
||
is the candidate path minus its tail). That is the property that keeps
|
||
completion, hover, definition and rename from ever disagreeing about what
|
||
`item.` is, and it is the reason the lead insisted the walk be published
|
||
from `vlog_semantic` rather than re-derived in the server.
|
||
- **Rework 1, lead-ruled**: the connection-list regression the dev filed
|
||
was not a follow-on — typing `.` inside a port map is the most common
|
||
RTL completion position and cannot ship as silence. Delivered through
|
||
`signature.rs`'s own list detector and the `Target::Port` walk
|
||
(`Semantics::instantiable_scope`), with already-connected ports dropped;
|
||
measured at 6.9 µs against the 212 µs dump it replaces.
|
||
- **Rework 2, QA-found**: `#(.` offered header `localparam`s. The root
|
||
cause predates the lane — the binder discarded `ParamPort.kw` and bound
|
||
every parameter as `Param` — and it was fixed at the root:
|
||
`SymbolKind::LocalParam`, keyword sticky across continuation entries
|
||
exactly as `instantiate::params` reads it (popup and ghost skeleton now
|
||
pinned against each other), exported wherever `Param` is, "localparam" on
|
||
the hover card, excluded from the override list only. `FACTS_FORMAT`
|
||
9 → 10. QA re-verified on four IPs' real `#(.` sites, including one where
|
||
the localparam was the only other candidate.
|
||
- Two of the dev's deviations stand as improvements over the brief:
|
||
`isIncomplete` at 1–2 typed characters after a separator (a prefix-filtered
|
||
member list *does* widen at the third keystroke) and an empty match
|
||
answering an empty list rather than `None` (the popup revives), extended
|
||
after QA's cold-index observation so an empty answer is always
|
||
incomplete. The behavior change worth naming to users: the whole-index
|
||
dump after a dot is gone — a dot now means members or nothing.
|
||
- The dev's early gate count (2 674 across 29 binaries) was a `tee` flush
|
||
artifact, confirmed by the lead's independent full run; final gates
|
||
2 887 passed / 0 failed over all 40 binaries, fmt clean, clippy zero
|
||
warnings, smoke OK. `docs/topo.md` row written and corrected for the
|
||
facts bump. Ships as 0.26.0 alongside escaped-identifiers, which ran in
|
||
parallel in its own worktree.
|