RelationsProvider

Trait RelationsProvider 

Source
pub trait RelationsProvider: Send + Sync {
    // Required methods
    fn extract_definitions(
        &self,
        file_info: &FileInfo,
    ) -> Result<Vec<Definition>>;
    fn extract_references(
        &self,
        file_info: &FileInfo,
        symbol_index: &HashMap<String, Vec<Definition>>,
    ) -> Result<Vec<Reference>>;
    fn supports_language(&self, language: &str) -> bool;
    fn precision_level(&self, language: &str) -> PrecisionLevel;
}
Expand description

Trait for extracting code relationships from source files.

Implementors of this trait can extract symbol definitions and references from source code files.

Required Methods§

Source

fn extract_definitions(&self, file_info: &FileInfo) -> Result<Vec<Definition>>

Extract definitions from a file.

Returns a list of all symbol definitions (functions, classes, etc.) found in the given file.

Source

fn extract_references( &self, file_info: &FileInfo, symbol_index: &HashMap<String, Vec<Definition>>, ) -> Result<Vec<Reference>>

Extract references from a file.

symbol_index maps symbol names to their definitions, used for resolving which symbol a reference points to.

Source

fn supports_language(&self, language: &str) -> bool

Check if this provider supports the given language.

Source

fn precision_level(&self, language: &str) -> PrecisionLevel

Get the precision level of this provider for the given language.

Implementors§