Show Call Hierarchy was empty in VS Code unless the cursor sat on a module
name. prepareCallHierarchy now answers on an instance name (its module),
on a function/task declaration, call or end label (a FUNCTION/METHOD item
with data {kind,name,offset}), inside a function/task body (that one), and
inside a module/interface/program (the enclosing module). Function/task
items: incomingCalls = call sites grouped by the enclosing function/task or
unit, over the same files references reads; outgoingCalls = resolved
callees (system tasks and unresolved names skipped). A function's bare name
in its own body is its result variable, not recursion. Module items keep
instantiation edges, byte-identical. prepareTypeHierarchy answers the
enclosing class inside a class body and the base on `super`.
QA (Opus): old module answers identical at 3 137 positions; outline,
definition, references, hover unchanged at 1 340 queries; findings fixed in
a rework (outgoing over a closed 300-function package 3.0 s -> 18 ms). Two
e2e assertions that pinned the old null flipped (lead's handshake).
lucisv_server 1 862 passed, 0 failed; fmt, clippy -D warnings clean.
docs/features/call-hierarchy-everywhere.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
call-hierarchy-everywhere
Lane A of a two-lane wave (2026-10-14). Builds on hierarchy (M11, the
module call hierarchy) and type-hierarchy (the class tree); both READMEs
point here for what changed.
Goal
A user report: in VS Code, "Show Call Hierarchy" showed nothing. The lead
reproduced it at the LSP level — prepareCallHierarchy answered only with the
cursor exactly on a module's declaration name or on an instantiated module
name, and null everywhere else (an instance name, anywhere in a module body,
on or inside a function or task); prepareTypeHierarchy answered null
anywhere inside a class body but on its name. An editor that opens nothing
from 95 % of the positions a user invokes the command from looks broken,
whatever the protocol allows. This feature makes both views open from wherever
the cursor is, and gives functions and tasks a call hierarchy of their own —
callers and callees resolved through the semantic and workspace layers, not by
name-matching strings.
What each prepare position answers
textDocument/prepareCallHierarchy, first match wins:
| cursor | answer |
|---|---|
| a module's own declaration name | that module (M11, byte-identical) |
| the module name of an instantiation | every declaration of it (M11, byte-identical) |
an instance name (u_sub in sub u_sub (…)) |
the instantiated module's item(s) — the same answer as its module name |
a function or task: its declaration name, a call, the endfunction : f label |
a function/task item (FUNCTION, or METHOD in a class); a call two files could answer gives both, as definition does |
anywhere else inside a function or task body (incl. its header and endfunction) |
that function or task |
| anywhere else inside a module, interface or program (incl. its header, comments, strings) | the innermost enclosing module's item, exactly as M11 builds it |
| a package body outside its functions, a file-level or package-level class body outside its methods, file scope, a large-file buffer | null |
A class declared inside a module is inside that module, so a position in
its body outside a method answers the enclosing module (the innermost-module
rule), not null. A cursor on a macro use (`CALL_IT(1)) is no name
either layer resolves, so it answers the enclosing function or module.
A position just past the last character of a name is on that name (M11's
caret rule, extended to calls: twice|(v) prepares twice).
textDocument/prepareTypeHierarchy: the class name or a use of it as before;
otherwise the innermost class whose declaration encloses the cursor; on
super, that class's base(s) (supertypes of the enclosing class), falling
back to the class itself when the base is unresolvable. this needs no case —
it is inside its class. Modules stay off the type hierarchy (the type-hierarchy
README's lead decision): a position in a module and outside every class is
still null.
Item kinds and data
| item | kind |
data |
|---|---|---|
| module / interface / program | MODULE (unchanged) |
none (unchanged) |
| function or task | FUNCTION; METHOD when declared in a class |
{"kind":"function"|"task","name":…,"offset":…} |
| package caller | PACKAGE |
{"kind":"package","name":…,"offset":…} |
| class caller | CLASS |
{"kind":"class","name":…,"offset":…} |
offset is the byte offset of the declared name in the item's file when the
item was built. detail on a function/task/package/class item is the name of
the container the declaration sits in (util_pkg, counter), so two log2s
in one list can be told apart; None at $unit.
incomingCalls/outgoingCalls route on data: an item whose data parses
as above goes to hierarchy/calls.rs; anything else (no data, or data
this server did not write) is a module item and takes the M11 path untouched.
Package and class caller items answer both directions with nothing.
Re-finding the declaration. The item's file (the open buffer, else a fresh
analysis of the file on disk) is searched for symbols of that name and kind:
the one whose name starts at offset, else the one at the item's
selectionRange start, else — by name alone — the only one of that name
and kind declared in the container the item's detail names (no container
for $unit). Otherwise the item answers nothing: unlike modules, two
functions of one name are ordinary, and the old "first of that name" fallback
let a stale item for mb's log2 answer for ma's (QA finding 3). detail
is the one echoed field relied on besides data, and only as a tie-break.
Incoming and outgoing
A call is a use of the function's name that the semantic layer resolved
to the declaration — in the declaring file through the symbol table or the
workspace overlay (super.f() reaches a base-class method through the
overlay), in another file through the overlay — and that is not one of three
non-call uses: the endfunction : f end label, the name of an out-of-body
definition (function void c::f();, recorded as a redeclaration), and the
Verilog result variable: a function's own name inside its own body with no
( after it, whether written (f = a;, f += 1;) or read
(clog2 = clog2 + 1;). f(…) inside its own body is recursion and is listed;
a bare f in another body is a call (a function with no arguments may be
called without parentheses) and is listed too.
incomingCalls — every call, workspace-wide, from the same files
textDocument/references reads for the same declaration: the declaring file;
for a declaration the index holds (a package or class member), every open
buffer plus every closed file the index has a reference posting for. The same
ambiguity contract too: a declaration whose uses the index marks ambiguous,
or an open buffer holding an ambiguous use of it, falls back to the declaring
file alone (references falls back to the cursor's file). Grouped one entry per
caller — the innermost enclosing function or task, else the enclosing module,
interface, program, package or class — with fromRanges the call names. A
call at file scope has no caller and is dropped (the same rule as an
instantiation outside a module). Sorted by caller URI, then line. A module
caller is the very M11 module item (no data), so expanding it walks
instantiations — one level up the design.
outgoingCalls — the calls written in the function's bodies (plural: an
extern prototype and its out-of-body definition are two scopes owned by one
symbol), each resolved to its declaration, grouped by callee in order of first
call. Skipped: system tasks and functions ($display is not a reference
at all), an unresolved name, and a name the overlay finds ambiguous — the same
silence M11's outgoingCalls keeps for an ambiguous instantiation, for the
same reason (a node pointing at the wrong one of two declarations is
unfalsifiable to the reader).
Module items do not mix in function calls (the brief's default, kept). A
module's outgoing calls are instantiations; listing always-block calls beside
them would put two relations behind one node with no way for a client to tell
them apart — exactly the argument the type-hierarchy README makes for keeping
modules off typeHierarchy. The function-to-module direction does mix, on
purpose: a function's caller may be a module, and that node is the module
item, whose own expansion is the design tree.
Each request answers one hop; recursion (fact calls fact) is the function
appearing as its own caller and callee, and the client drives the expansion.
Assumptions
- Callers are found by re-analysing files, not from the index's spans.
Attribution needs the enclosing scope of every call, which a reference
posting does not carry, so each candidate closed file is parsed and analysed
once (
Document::new) — the cost is one parse per file that references the function, the same order asincomingCallsfor modules reading the files that instantiate. The file selection is references'; the spans are the live analysis's, so a closed file edited on disk since the last index build answers with its current text (references would drop the stale span). - The result variable is recognised by scope plus one token: the use
resolves to a function, sits in a body that function owns (its own scope
or an out-of-body definition's), and the next token is not
(. Tasks have no result variable. This is the only token-level judgement; everything else is the semantic model's. - An end label is recognised structurally: it lies inside the extent of
the scope its declaration opens but is recorded in the scope around it
(
vlog_semantic'suse_end_label). A recursive call is recorded inside. - Two declarations of one name and kind in one file resolve by
offset; when an edit has moved both the offset and the selection range, by the item'sdetail(container), and otherwise not at all — see "Re-finding the declaration". - The two ambiguity fallbacks are defensive.
indexed_def_for_symbolaccepts a declaration only when its unit's member table holds exactly one record for the name, and every use's lookup reads that same table, so in a consistent workspace no use can be ambiguous and include a declaration this feature stands on. The decision lives in one predicate,declined, whose two clauses are each pinned by a unit test that reaches it directly (an indexed caller of a twice-declared package; an open buffer outside the indexed folder); kept because references has the same contract and a future index rule could make the case reachable. - A function's caller inside a class body but outside a method (a
property initializer) is the class; inside a package outside a function, the
package. Both are items with
dataand no further hops.
Limits
- A
$unitfunction called from another file is not resolved: the semantic layer finishes an unqualified value-position name only through imports, soufn(1)in a file that does not declareufnisNotFound. In-file calls work. The cursor on such a call falls back to the enclosing module. Pinned byhierarchy_everywhere::a_unit_scope_function_answers_in_its_own_file_only. - A module's own function called hierarchically from another module
(
u_core.twice()) is not a call this feature sees: module-level functions are on no index surface (surface_of(Module, Function)isNone). - The end label of an out-of-body definition records no use in the binder, so prepare on it falls back to the enclosing function (the definition's own body), which is the right item anyway.
- Class methods: calls through
this., a bare name, a typed handle (same file and across files, throughimport) andsuper.all resolve and are listed. Virtual dispatch is not modelled:h.f()is a call of thefthe handle's declared class resolves to, not of every override. prepareTypeHierarchyonsuperwith an unresolvable base answers the enclosing class rather thannull.- Macros are not expanded. A cursor on a macro use answers the enclosing
function or module, and a call written inside a macro body (
`CALL_IT(1)expanding tocf(1)) is not listed byincomingCallsoroutgoingCalls— the same answer references gives, since neither layer sees the expansion.
Handshakes
- Consumes
vlog_semantic(read-only, nothing new asked):Semanticsscopes/symbols/references/duplicates,ExternalResolutions::{definition_of, get},WorkspaceIndex::{references_to, references_are_ambiguous, path}. - Consumes
crate::nav::indexed_def_for_symbol(alreadypub(crate)) — the identity references uses to map a live symbol onto its indexed declaration, so this feature and references agree on what "the same function" is by construction.nav.rsis unchanged. - Consumes
crate::state:Document::new(a fresh analysis of a closed file, astype_hierarchy::supertypesalready does),document,document_for_path,open_documents,text_of,first_token_from,first_token_reaching. Unchanged. - Promises
server/dispatch.rs: nothing new —hierarchy::{prepare, incoming, outgoing}andtype_hierarchy::preparekeep their signatures, and the routing ondatalives insidehierarchy.rs.dispatch.rsis untouched. - Promises clients: a module item is byte-identical to M11's wherever M11
answered;
datais present exactly on function, task, package and class items. - REQUEST to the lead —
crates/lucisv_server/tests/e2e.rs(not in this lane's file list). Two e2e round trips pin the oldnullat positions the brief now makes answer, and fail on this lane:the_module_hierarchy_round_trips_over_the_wire_in_both_directions, line 3401:assert_eq!(response(5)["result"], Null, "an instance name is no module")— request 5 is the cursor on the instance nameu_midofhier_mid u_mid ();; it now answers thehier_miditem. Proposed:assert_eq!(response(5)["result"][0]["name"], "hier_mid", "an instance name stands for its module")(and the comment above request 5, "The instance name is not a module, so there is no hierarchy to open.", to match).the_class_hierarchy_round_trips_over_the_wire_in_both_directions, line 4876:assert_eq!(response(5)["result"], Null, "a property name is no class")— request 5 is the property nameyinsidetype_mid; it now answerstype_mid. Proposed:assert_eq!(response(5)["result"][0]["name"], "type_mid", "inside a class body, the enclosing class")(and the comment above request 5). No other test outside this lane's files moved.
- Note for a future
vlog_semanticround (not a request this lane blocks on): resolving an unqualified call to a$unitfunction declared in another file would lift the first limit above. It is a resolution-rule change (compilation-unit scope is tool- and filelist-dependent), not something to work around here. editors/vscodeneeds no change (lane B owns it): the client already sendsprepareCallHierarchy/prepareTypeHierarchyfrom any position.
Status / TODO
prepareCallHierarchy: instance name, function/task (declaration, call, end label), inside a function/task body, inside a module body,nullelsewhere —hierarchy.rs::prepare,hierarchy/tf.rs- function/task items with
data; package/class caller items incomingCallswith references' file selection and ambiguity fallback, grouped by caller —hierarchy/calls.rsoutgoingCallsover the body (and an out-of-body definition), grouped by callee; system tasks, unresolved and ambiguous names skipped- module items unchanged in both directions
prepareTypeHierarchyinside a class body,super→ base —type_hierarchy.rs- tests: 24 LSP-level in
server/tests/hierarchy_everywhere.rs, 3 inhierarchy/tf.rs, 4 inhierarchy/calls.rs, 1 new inhierarchy.rs; seven existing unit tests that pinned the oldnullupdated (work log) - probe before/after on real server binaries (work log)
tests/e2e.rs: two assertions to update — Handshake request above (lead; flipped by the lead, verified green by QA 2026-10-14)cargo fmt --all --check, clippy-D warnings;cargo test -p lucisv_servergreen except the two e2e assertions above- rework after QA (2026-10-14): findings 1–5 and 7 fixed, with tests
Work log
-
2026-10-14 (dev) — read CLAUDE.md, the hierarchy and type-hierarchy READMEs,
hierarchy.rs,type_hierarchy.rs,nav.rs(references),vlog_semantic's model, binder and instantiation walk.Probed the semantic model first (a throwaway test dumping scopes, symbols, references and duplicates for module, package, class, extern and
$unitfunctions; deleted). What it showed shaped the design: a function's scope spans its whole declaration includingendfunction : f; the end label is a reference recorded in the outer scope;f = a;resolves tof;c::ext's name is a reference to the prototype and aDuplicate; the out-of-body body is a second scope owned by the prototype's symbol;this.f()andh.f()resolve locally;$displayrecords nothing.Decision — collect callers here rather than reuse
nav::references.referencestakes a cursor in an open document, and the item a client expands is very often in a closed one (prepare on a call incore.sv, the declaration lives in a closed package file). Makingnav.rstake a&Documentwas outside this lane's files, socalls.rsreads the same file set through the same public index API (references_to,references_are_ambiguous) and the same identity (nav::indexed_def_for_symbol), and a test (the_cross_file_answer_matches_references) asserts the two agree location for location, end label aside.Decision — routing on
datainsidehierarchy.rs, sodispatch.rsis untouched and a module item's path is literally the old code.Decision — module callers are M11 module items. Expanding a function's caller
topthen shows who instantiatestop, which reads as one call chain up the design; the reverse direction (module → functions) stays closed, argued above.Found while testing:
super.bump()resolves through the workspace overlay (an inherited candidate), not the local table, so the first cut's declaring-file matcher (resolved() == symbol) missed it whileoutgoingCalls(which reads both layers) found it. Fixed: the declaring file accepts either layer; pinned byclass_methods_called_through_this_a_handle_and_super.Existing tests changed — seven, all pins of the old
nullat positions the brief now makes answer (the brief asks both for these answers and for existing tests "green and unchanged"; the two cannot both hold, so each one was changed to assert the new answer, renamed where its name stated the old one, and given a "Reversed by call-hierarchy-everywhere" doc line):hierarchy.rs:a_position_on_no_module_prepares_nothing→…_prepares_the_enclosing_one_or_nothing(modulekeyword and a connected expression →top, instance name →sub; the package case stillnull);an_instantiation_of_a_module_nothing_declares_prepares_nothing→…_prepares_the_enclosing_module;qa_prepare_on_a_string_or_comment_is_null→…_is_the_enclosing_module_not_the_text;qa_prepare_on_a_bind_target_module_name_is_currently_null→…_was_null(nowtop, the module the bind is written in) plus a new…_is_the_enclosing_modulewith the bind moved into aharnessso target and enclosing module differ.type_hierarchy.rs:a_position_on_no_class_prepares_nothing→…_prepares_the_enclosing_one_or_nothing(classkeyword and a property →base; module and wire stillnull);prepare_on_the_extends_keyword_itself_prepares_nothing→…_prepares_the_class_it_is_written_in(child, neverbase);a_class_name_shadowed_by_a_local_variable_prepares_the_variable_use_as_nothing→…_prepares_the_enclosing_class(child, neverbase). The generate-class "known gap" pin is unchanged and green: the enclosing-class fallback reads the sameclasses::declarationswalk, so a class that walk cannot see is not a node from the inside either. The two e2e pins of the same kind are a Handshake request (not this lane's file).Probe (
probe.pyagainstproj/, asub/top/clstrio; "before" is a debug build of master41a9091fromgit archive, "after" this lane's debug build):position before after instance name u_sub null sub (MODULE, data null) inside module body (logic r) null sub inside always_ff null sub function decl inv null inv (FUNCTION, data function) call inv(r) null inv inside poke body null poke (data task) on endfunction keyword null inv task decl poke null poke module decl sub sub sub (identical) call hello() in leaf_c::go null hello (METHOD, base_c's) incoming(inv) = [poke @9] outgoing(poke) = [inv @9] incoming(hello) = [go (METHOD) @9] type: class name mid_c mid_c mid_c type: inside leaf_c method body null leaf_c type: module body null nullGates.
cargo fmt --all --checkclean;tools/guard.sh -- cargo clippy --workspace --all-targets -- -D warningsclean;tools/guard.sh -t 1800 -- cargo test -p lucisv_server: unit/server binary 1753 passed, 36 ignored (1757 tests before → 1789 after, +32);tests/e2e.rs97 passed, 2 failed, 2 ignored — the two failures are exactly the Handshake request above;tests/grammar.rsgreen. No change tovlog_semanticorvlog_refactorbehaviour, so their suites were not re-run. No new dependencies. No commits.Files. New:
crates/lucisv_server/src/hierarchy/tf.rs,crates/lucisv_server/src/hierarchy/calls.rs,crates/lucisv_server/src/server/tests/hierarchy_everywhere.rs, this README. Edited:crates/lucisv_server/src/hierarchy.rs(prepare chain, routing ondata, test updates),crates/lucisv_server/src/type_hierarchy.rs(enclosing-class fallback,super, test updates),crates/lucisv_server/src/server/tests/mod.rs(onemodline),docs/features/hierarchy/README.mdanddocs/features/type-hierarchy/README.md(pointer notes). Not touched:dispatch.rs,nav.rs,main.rs,vlog_*,editors/,TODO.md. -
2026-10-14 (dev) — rework after QA. QA's findings 1–5 and 7.
- Result variable (MEDIUM).
is_callnow treats a function's own name inside a body it owns, with no(after it, as the result variable — read or written — and drops the separate assignment-operator check it subsumes.f(…)there stays recursion; a bareffrom another body stays a call. The unit test that pinned+ fas a call is flipped; new:the_result_variable_read_in_its_own_body_is_not_a_call(QA'sclog2),a_bare_function_name_in_another_body_is_a_call, and the LSP-levelthe_classic_clog2_is_not_its_own_caller. - Per-callee re-parse (MEDIUM, perf).
tf::Loadedholds one analysis per path for the life of one request;outgoingCallsand prepare's multi-declaration answer build every cross-file item through it, andlive_symbolasks identity of the symbol at the recorded position first. QA's shape (one closed 430 KB package of 300 functions, a caller calling all 300,scratchpad/lsp/gen_perf.py+s_perf.py), release builds, three runs each: before 3 043 / 3 018 / 3 032 ms, after 21 / 18 / 17 ms. - Stale item (LOW-MEDIUM). The "first of that name" fallback is gone:
by name alone only the one candidate in the item's
detailcontainer answers, asked even of a lone candidate (a renamed-awaymbleavesma'slog2as the only one, and it is still the wrong function). New:a_stale_item_never_answers_for_a_same_named_function_elsewhere(QA'sma/mbreproduction: after the move it answersmb's callers, after the rename nothing). - Ambiguity fallbacks (coverage). Both checks now sit in one
predicate,
declined, called once before any file is read (same answers: either clause still returns the declaring file alone). Its clauses are each killed by a unit test:an_index_that_marks_the_uses_ambiguous_declines(no buffer open, an indexedp::f()withpdeclared twice),an_open_buffer_holding_an_ambiguous_use_declines(index clean, a buffer outside the indexed folder), plusan_ambiguous_use_in_the_declaring_file_itself_does_not_decline. Not killable end to end, and why: with a consistent workspace the branch cannot be reached throughincomingCalls— see the new Assumption "The two ambiguity fallbacks are defensive". Removing the singleif declined(..)line inother_filestherefore still survives the suite; the predicate it calls does not. - README. Limits: macro uses and calls inside macro bodies. The prepare table: a class inside a module answers the module.
Gates.
cargo fmt --all --checkclean; clippy-D warningsclean;tools/guard.sh -t 1800 -- cargo test -p lucisv_server: guard exit 0; server binary 1760 passed, 0 failed, 36 ignored (1753 before the rework, +7: five inhierarchy/calls.rs, two inserver/tests/hierarchy_everywhere.rs);tests/e2e.rs99 passed, 2 ignored;tests/grammar.rs3 passed. - Result variable (MEDIUM).
QA log
2026-10-14 — QA agent (Opus)
Verdict: PASS with findings. No corruption, panic or regression found; the
M11 module answers are byte-identical and no other client-visible feature moved.
Two medium findings (a false self-recursion for the classic Verilog result-variable
idiom, and per-callee re-parsing in outgoingCalls) are worth fixing before
release but block nothing else.
Gates (in this worktree):
cargo fmt --all --check: clean.tools/guard.sh -- cargo clippy --workspace --all-targets -- -D warnings: clean, guard exit 0.tools/guard.sh -t 1800 -- cargo test -p lucisv_server: guard exit 0. Unit/server binary 1753 passed, 0 failed, 36 ignored;tests/e2e.rs99 passed, 0 failed, 2 ignored (the lead's two flipped assertions included);tests/grammar.rs3 passed. No host stall.
Mutation check (a scratch copy of the tree, cargo test -p lucisv_server --bin lucisv-server hierarch, 144 tests in the filter). Killed: return-assignment
check removed (4 failures), instance-name path removed (2), data.offset ignored
in tf::target (1), end-label exclusion removed (3), super → base removed (1),
the caret rule (offset - 1) removed (1), the overlay acceptance in the declaring
file removed (1). Survived: both ambiguity fallbacks (finding 4).
Byte-identity vs master 41a9091. Built 41a9091 in a scratch git worktree
(removed afterwards). Ran prepareCallHierarchy at every character offset of
three projects (3 137 positions: the dev's sub/top/cls trio; an attack
project with packages, classes, DPI, generate and macros; and a module-hierarchy
project with interfaces, a program, multi-instance statements, generate for/if,
parameter overrides, an undeclared module and a bind). Wherever the old server
answered (124 positions), the new answer is identical, byte for byte. The
incomingCalls/outgoingCalls answers on all 15 distinct module items are also
identical. The old server answered 124 positions and the new one answers 2 832.
Other features unchanged. On two projects, compared documentSymbol per file
plus definition, references and hover at every identifier (1 340 queries)
between the old and new binaries: 0 differences.
Attacks over the wire (probe.py, debug build unless noted). Each was as the
README describes, unless it is listed under findings:
- Ambiguity. A module two files declare gives both items, and each has the
instantiating module as its caller. A package two files declare (
pzinz1.sv/z2.sv): a call prepares both items, asdefinitionanswers 2; incoming is empty for both (the declaring-file fallback). - A function and a module with the same name (
module gplusfunction ginhost). On the instantiation's module name and on its instance name, the answer is moduleg(MODULE, nodata). On the callg(1)and on the declaration, it is functiong(FUNCTION,detailhost). A module that nothing declares, named like an in-scope function (nope u1 ();), answers the enclosing module, never the function. - Shadowing. In task
sh, the localint g, written or read, preparessh, never the functiong. externprototype, out-of-bodyc::extname, its end label: all prepare the prototype, and outgoing lists the callees in the out-of-body body (hook,helper).push_back,.size(),randomize(),this.randomize() with {…}: the enclosing method, with no crash and no callee listed.- DPI imports (
import "DPI-C" function int c_add…, acontext task): FUNCTION or TASK items,detailnone, incoming the module that calls them, outgoing empty. That is a sensible answer. $displayis the enclosing module. A call in a parameter default (#(parameter int P = cf(3))), alocalparam, a continuousassign, and anassignin a generateforare all credited to the module. A call at file scope is dropped.- Caller attribution. A call in
initial,final, analways_combnamed block or aforknamed block is credited to the enclosing module, method or task. A call in a packagelocalparamis credited to the PACKAGE item, and one in a class property initializer to the CLASS item. Qualifiedpk::kfis the same function. - Stale and foreign items (finding 3 covers the one gap). These all answer empty
or correct, never a panic or a wrong file:
offset99 999 999, a nonexistent name,kindclass/package/taskon a function, selection range line 99 999 or character 4e9,untitled://etc/hosts/ a directory / a missing file as URI,datamissing / null / a string, extra fields indata. - Large-file mode: in a 5 MB buffer, call prepare, type prepare and the module name
all answer
null, and a package function's incoming skips it. - UTF-16: ranges after
✓comments are correct (character 18 where the UTF-16 count is 18). - Type hierarchy: a method body and an out-of-body body give the class; a class
inside a module gives the class; a module body and a package body give
null.
Timing. Release build, 200 closed files each calling big_pkg::pf 31 times
from a module and 10 functions, with only pkg.sv and m000.sv open:
- prepare: 2 ms;
incomingCalls: 76 / 65 / 55 ms over three runs, 2 200 callers and 6 200 ranges. This equalsreferences(6 200 locations, 23 ms).- Server RSS: 13 MB, then 69 MB after the first incoming, then flat.
- Debug build: incoming 325 / 312 / 302 ms, references 89 ms, 74 MB.
The README's "each referencing closed file is parsed once" holds for incoming. It does not hold for outgoing (finding 2).
Code review. Production lines (non-blank, non-comment, before mod tests):
hierarchy.rs 212, hierarchy/tf.rs 216, hierarchy/calls.rs 246,
type_hierarchy.rs 189. All functions are under 50 lines. Production code has no
unwrap/expect/panic, no new indexing (the one slice in type_hierarchy.rs
predates the lane), and no byte slicing of text (Positions::offset clamps). The
README test counts (24 / 3 / 4) match the code.
Findings
- Medium: a Verilog result-variable read is counted as a recursive call.
crates/lucisv_server/src/hierarchy/calls.rs:208-227(is_call). The unit testcalls.rs:337-354pins+ f(a bare read) as a call. Reproduction:module lg (output integer o); function integer clog2(input integer v); begin clog2 = 0; while (v > 1) begin clog2 = clog2 + 1; v = v >> 1; end end endfunction initial o = clog2(16); endmoduleoutgoingCalls(clog2)=[clog2 @6], andincomingCalls(clog2)listsclog2as its own caller at line 6. That is a false recursion on one of the most common Verilog-2001 idioms. Inside a function's own body, its name without a following(is the result variable, not a call. That is a token-level rule of the same kind as the existingassignedcheck, and it applies to functions only. - Medium (performance):
outgoingCallsparses a closed callee file once per distinct callee.calls.rs:272callstf::def_item, which callstf.rs:243load_path, which callsDocument::newfor every callee. Reproduction: a 236 KB closed package with 300 functions, and a caller functionallthat calls all 300. In the release build,outgoingCalls(all)takes 3 503 ms, and 34 ms once the package is open. The cost is about 12 ms per callee for this file size. A per-request cache of loaded analyses keyed by path would make it one parse per file, as incoming already is. - Low-Medium: after an edit, a stale item silently resolves to a different
function with the same name.
crates/lucisv_server/src/hierarchy/tf.rs:293-295(thecandidates.first()fallback). Reproduction:module maandmodule mb, each declaringlog2. Preparemb'slog2, thendidChangeto add 3 comment lines at the top.incomingCallswith the old item answersma's caller (line 9). After renamingmb's function tolg, the old item also answersma's callers. The README documents this fallback (Assumptions, "the module rule"), but its own Goal says two functions of one name are ordinary. For modules the fallback is rarely wrong; for functions it often is. Suggestion: fall back to the first candidate only when it is the only one, or break the tie on the item'sdetail(container name). - Low (coverage): the two ambiguity fallbacks are untested.
calls.rs:79-81(references_are_ambiguous) andcalls.rs:86-88(names_it_ambiguously). Each removed alone, the 144 hierarchy tests stay green. The README claims "the same ambiguity contract" as references. A test with two files declaring one package, and the user file closed and then open, would pin it. - Info: a cursor on a macro use gives the enclosing module, and a call inside a
macro body is not listed. For
`CALL_IT(1)expanding tocf(1), incoming(cf) omits that line. This matches references, since there is no macro expansion, but it is not in the README's Limits. - Info: an ambiguous wildcard import resolves to the first package. With
import pa::*; import pb::*;and both declaringf,f(1)preparespa::fand is listed in its incoming. This is the semantic layer, anddefinitionandreferencesgive the same answer. It is not this lane's. - Info: the doc row "a class body outside its methods → null" does not apply to a class declared inside a module. There the enclosing module answers. This is consistent with the "innermost enclosing module" rule; the table row could say "a file-level class".
Fixes made by QA: ticked the tests/e2e.rs Status item, since the lead
flipped both assertions and the suite is green. No code changed.
Review
2026-10-14 — lead. Accepted after one rework. The user's report (Show
Call Hierarchy empty in VS Code) was a prepare that answered only on a
module name; it now answers from any position inside a module, function or
task, and functions/tasks are call-hierarchy nodes of their own. QA (Opus)
confirmed the old module answers byte-identical at 3 137 positions and no
change in outline/definition/references/hover at 1 340 queries; its two
mediums (result-variable reads counted as recursion; outgoing re-parsing a
closed file per callee, 3.0 s → 18 ms) and the stale-item fallback are
fixed with tests. The e2e handshake is granted: two assertions that pinned
the old null now assert the new answers. The one surviving mutant (the
declined call in other_files) guards a branch the index makes
unreachable today; kept, and recorded as an Assumption. Merged onto master
with the lane-B references view; gates re-run on the merged tree.