Expand description
Call hierarchy support for the Solidity language server.
This module provides the query logic and LSP conversion helpers for
the Call Hierarchy feature (textDocument/prepareCallHierarchy,
callHierarchy/incomingCalls, callHierarchy/outgoingCalls).
§Architecture
Call hierarchy queries are derived from the same nodes index that
powers textDocument/references. Every AST node with a
referencedDeclaration is a potential call edge. The caller/callee
relationship is resolved via span containment: for each reference
node, we find the smallest enclosing FunctionDefinition or
ModifierDefinition — that is the “caller”.
This approach works uniformly on both fresh builds (CachedBuild::new())
and warm-loaded builds (from_reference_index()) because the nodes
index is always populated.
§Equivalence
When base_function_implementation is populated, incoming calls expand
the target to include all equivalent IDs (interface ↔ implementation),
so callers via interface-typed references are included.
Functions§
- call_
src_ to_ range - Convert a
call_srcstring to an LSPRange. - decl_
to_ hierarchy_ item - Convert a
DeclNodeinto aCallHierarchyItem. - find_
node_ info - Find a node in the
nodesindex by ID, searching all files. - incoming_
calls - Find all incoming calls to the given target IDs.
- node_
info_ to_ hierarchy_ item - Convert a
NodeInfo(from the nodes index) into aCallHierarchyItem. - outgoing_
calls - Find all outgoing calls from a given caller function/modifier.
- resolve_
callable_ at_ position - Resolve a callable at a cursor position.
- resolve_
target_ in_ build - Resolve a target callable’s node IDs within a single build.
- verify_
node_ identity - Verify that a
NodeIdin a specific build refers to the expected source entity.