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§
Sourcefn extract_definitions(&self, file_info: &FileInfo) -> Result<Vec<Definition>>
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.
Sourcefn extract_references(
&self,
file_info: &FileInfo,
symbol_index: &HashMap<String, Vec<Definition>>,
) -> Result<Vec<Reference>>
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.
Sourcefn supports_language(&self, language: &str) -> bool
fn supports_language(&self, language: &str) -> bool
Check if this provider supports the given language.
Sourcefn precision_level(&self, language: &str) -> PrecisionLevel
fn precision_level(&self, language: &str) -> PrecisionLevel
Get the precision level of this provider for the given language.