Skip to main content

WorkspaceSymbols

Struct WorkspaceSymbols 

Source
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

Source

pub fn contains(&self, qname: &str) -> bool

Exact qname membership test.

Source

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".

Source

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.

Trait Implementations§

Source§

impl Clone for WorkspaceSymbols

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkspaceSymbols

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkspaceSymbols

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.