Symbols & References
Structural lookup is the exact, graph-shaped side of RCE Code. Instead of ranking text it answers precise questions about definitions and the edges between them: where is this symbol defined, who refers to it, who calls it, and what does it call. These come from tree-sitter extraction plus a heuristic resolver that links references back to the symbols they name.
Everything here is keyed off the symbols and refs tables. A Symbol is a definition (its name, qualified name, kind, file, line/column span, parent, and signature). A Reference is a call or import site, with the name it targets and — once resolved — the symbol id it points to plus a confidence.
By-name vs. resolved
The single most important distinction is whether a query works purely on names or on the resolved reference graph. Resolution is a best-effort, name-based heuristic — not a type checker — so resolved queries are higher precision but only cover references the resolver was confident about.
find_references(name)— every reference whose target name matches, resolved or not. Broadest recall; finds all the call/import sites that mention a name.get_references_from(symbol_id)— outgoing references that originate inside a symbol's body, by name. These may be unresolved (the target symbol id can beNone).get_references(symbol_id)— incoming references that the resolver linked to this symbol. Resolved only; these are the confident inbound edges.get_callers(symbol_id)/get_callees(symbol_id)— the resolved call graph. Callers are symbols whose body contains a resolved reference to this symbol; callees are symbols this one resolves a reference to. Both returnSymbols, notReferences.
Resolution confidence
resolution_confidence on each reference. A target found in the same file scores 0.9; a target that is unique across the project scores 0.5; an ambiguous name with several candidate definitions is left unresolved (target id NULL). The resolved-graph queries — get_references, get_callers, get_callees — only see edges where a target was assigned.Finding definitions
Several methods locate Symbol definitions. find_symbol(name, kind=None) returns every definition with that exact name, optionally filtered by SymbolKind (e.g. FUNCTION, CLASS, METHOD). get_definitions(file) lists every definition in a file in source order. get_definition_at(file, line, col) returns the innermost symbol whose span contains a position (column is 0-indexed), and get_symbols_in_chunk(chunk_id) returns the definitions that belong to a given chunk — handy for bridging a search hit back to its symbols.
Walking the reference graph
With a symbol's id you can traverse edges in both directions. The example below finds a function, lists who calls it and what it calls, and shows the difference between by-name and resolved reference queries.
Query-to-method map
| You want… | Python method | CLI command |
|---|---|---|
| Definitions in a file | engine.get_definitions(file) | rce-code symbols <file> |
| Definitions by name (anywhere) | engine.find_symbol(name) | rce-code find <name> |
| Definition at a position | engine.get_definition_at(file, line, col) | Python only |
| Definitions in a chunk | engine.get_symbols_in_chunk(chunk_id) | Python only |
| All references to a name (any resolution) | engine.find_references(name) | rce-code refs <name> |
| Outgoing refs from a symbol (by name) | engine.get_references_from(symbol_id) | Python only |
| Resolved incoming refs to a symbol | engine.get_references(symbol_id) | Python only |
| Resolved callers of a symbol | engine.get_callers(symbol_id) | rce-code callers <name> |
| Resolved callees of a symbol | engine.get_callees(symbol_id) | rce-code callees <name> |
The CLI resolves names for you
symbol_id. The CLI's callers and callees commands take a name: they call find_symbol first and then walk the graph for each matching symbol, so a name with several definitions reports edges for all of them.