pub struct WorkspaceSymbols {
pub qnames: HashSet<String>,
pub kinds: HashMap<String, SymbolKind>,
pub suffix_index: HashMap<String, Vec<String>>,
pub properties: HashMap<String, String>,
}Expand description
Workspace-wide context passed to adapters when resolving call edges across module boundaries.
§Suffix-based lookup
Qnames include file-path prefixes (e.g., Sources.Models.DriftCompiler.compile).
A call site using DriftCompiler.compile(...) only sees the type+method tail.
After inserting all qnames, call [build_suffix_index] once so that
[find_by_suffix] can resolve "DriftCompiler.compile" → the full qname in O(1).
§Cross-file property map
Stored property declarations (let name: TypeName / var name: TypeName)
are collected across ALL files in the current index run and stored in
properties as "EnclosingTypeSimpleName.propName" → "TypeSimpleName".
Call adapters populate this via LanguageAdapter::extract_property_types.
Swift uses it to resolve pool.resolve() → DriftSynthPool.resolve when
pool: DriftSynthPool is declared in a different file of the same project.
Fields§
§qnames: HashSet<String>All qnames known to the indexer, flat.
kinds: HashMap<String, SymbolKind>Map from qname to its kind, so adapters can distinguish class-level methods from module-level functions during resolution.
suffix_index: HashMap<String, Vec<String>>suffix → Vec<full_qname>. Built by [build_suffix_index].
Each key is a 2-or-more component tail of a qname, e.g.
"DriftCompiler.compile" → ["Sources.Models.DriftCompiler.compile"].
properties: HashMap<String, String>Cross-file property map: "EnclosingTypeSimple.propName" →
"TypeSimpleName". Populated by the index pipeline from ALL files
via LanguageAdapter::extract_property_types before call-graph
extraction runs. Allows resolving instance property calls when the
property declaration is in a different file than the method body.
Implementations§
Source§impl WorkspaceSymbols
impl WorkspaceSymbols
Sourcepub fn build_suffix_index(&mut self)
pub fn build_suffix_index(&mut self)
Build the suffix index from the current qnames set. Must be called
once after all qnames have been inserted, before any find_by_suffix
calls. Safe to call multiple times (rebuilds from scratch each time).
For every qname with N dot-separated components, indexes all tails
of length 2..=N so that "TypeName.method" matches
"file.path.TypeName.method".
Sourcepub fn find_by_suffix<'a>(&'a self, suffix: &str) -> Option<&'a str>
pub fn find_by_suffix<'a>(&'a self, suffix: &str) -> Option<&'a str>
Look up a qname by suffix (e.g., "DriftCompiler.compile").
Returns the unique full qname when exactly one workspace qname ends
with .<suffix> or equals suffix exactly. Returns None when no
match is found or when the suffix is ambiguous (multiple matches).
Requires [build_suffix_index] to have been called after the last
batch of qname inserts.