pub trait LanguageAnalyzer: Send + Sync {
// Required methods
fn language_name(&self) -> &'static str;
fn analyze_file(
&self,
path: &Path,
content: &str,
context: &SemanticContext,
) -> SemanticResult<AnalysisResult>;
fn can_handle_extension(&self, extension: &str) -> bool;
fn supported_extensions(&self) -> Vec<&'static str>;
// Provided methods
fn analyze_imports(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<Import>> { ... }
fn analyze_function_calls(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<FunctionCall>> { ... }
fn analyze_type_references(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<TypeReference>> { ... }
fn resolve_type_definition(
&self,
_type_ref: &TypeReference,
_context: &SemanticContext,
) -> Option<PathBuf> { ... }
}Expand description
Base trait for language-specific analyzers
Required Methods§
Sourcefn language_name(&self) -> &'static str
fn language_name(&self) -> &'static str
Get the language name
Sourcefn analyze_file(
&self,
path: &Path,
content: &str,
context: &SemanticContext,
) -> SemanticResult<AnalysisResult>
fn analyze_file( &self, path: &Path, content: &str, context: &SemanticContext, ) -> SemanticResult<AnalysisResult>
Analyze a file and extract semantic information
Sourcefn can_handle_extension(&self, extension: &str) -> bool
fn can_handle_extension(&self, extension: &str) -> bool
Check if this analyzer can handle the given file extension
Sourcefn supported_extensions(&self) -> Vec<&'static str>
fn supported_extensions(&self) -> Vec<&'static str>
Get file extensions this analyzer handles
Provided Methods§
Sourcefn analyze_imports(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<Import>>
fn analyze_imports( &self, content: &str, context: &SemanticContext, ) -> SemanticResult<Vec<Import>>
Parse and analyze imports from the file
Sourcefn analyze_function_calls(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<FunctionCall>>
fn analyze_function_calls( &self, content: &str, context: &SemanticContext, ) -> SemanticResult<Vec<FunctionCall>>
Parse and analyze function calls from the file
Sourcefn analyze_type_references(
&self,
content: &str,
context: &SemanticContext,
) -> SemanticResult<Vec<TypeReference>>
fn analyze_type_references( &self, content: &str, context: &SemanticContext, ) -> SemanticResult<Vec<TypeReference>>
Parse and analyze type references from the file
Sourcefn resolve_type_definition(
&self,
_type_ref: &TypeReference,
_context: &SemanticContext,
) -> Option<PathBuf>
fn resolve_type_definition( &self, _type_ref: &TypeReference, _context: &SemanticContext, ) -> Option<PathBuf>
Resolve a type reference to its definition file Returns None if the type cannot be resolved or is external
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".