pub struct TreeSitterAnalyzer { /* private fields */ }Implementations§
Source§impl TreeSitterAnalyzer
impl TreeSitterAnalyzer
pub fn new() -> Self
Sourcepub fn find_containing_symbol(
&self,
file_path: &Path,
line_number: usize,
project_root: &Path,
) -> Option<String>
pub fn find_containing_symbol( &self, file_path: &Path, line_number: usize, project_root: &Path, ) -> Option<String>
Given a file path and a 1-based line number, find the innermost
named definition (function, struct, enum, trait, impl) that contains
that line. Returns a canonical CodeStruct-style selector like
src/foo.rs::fn authenticate #L10-L20.
pub fn find_containing_symbol_match( &self, file_path: &Path, line_number: usize, ) -> Option<SymbolMatch>
Sourcepub fn resolve_selector(
&self,
file_path: &Path,
parsed: &ParsedSelector,
) -> Result<SymbolMatch, String>
pub fn resolve_selector( &self, file_path: &Path, parsed: &ParsedSelector, ) -> Result<SymbolMatch, String>
§Errors
Returns an error if the source file cannot be read, parsed, or matched to a symbol.
Sourcepub fn symbols_in_file(
&self,
file_path: &Path,
) -> Result<Vec<SymbolMatch>, String>
pub fn symbols_in_file( &self, file_path: &Path, ) -> Result<Vec<SymbolMatch>, String>
§Errors
Returns an error if the file extension is unsupported, the file cannot be read, or parsing fails.
pub fn is_import_only_reference( &self, file_path: &Path, line_number: usize, ) -> bool
Sourcepub fn can_parse(&self, ext: &str, content: &str) -> bool
pub fn can_parse(&self, ext: &str, content: &str) -> bool
Validate that a file’s content can be parsed by tree-sitter. Returns true if parsing succeeds (i.e. the file is syntactically valid for the given language), false otherwise.
Sourcepub fn parse_error_diagnostic(
&self,
ext: &str,
content: &str,
) -> Option<ParseErrorDiagnostic>
pub fn parse_error_diagnostic( &self, ext: &str, content: &str, ) -> Option<ParseErrorDiagnostic>
Return the first tree-sitter parse diagnostic for this source, if any.
Tree-sitter does not expose compiler-style syntax diagnostics. It recovers by placing ERROR and MISSING nodes in the parse tree. This helper reports the first such node with source coordinates and a compact snippet so edit rejection messages can point at the likely problem.
Sourcepub fn responsible_language_for_extension(
&self,
ext: &str,
) -> Option<&'static str>
pub fn responsible_language_for_extension( &self, ext: &str, ) -> Option<&'static str>
Return the SCOPE language adapter that owns semantic source operations for the given extension.
Sourcepub fn is_responsible_source_path(&self, file_path: &Path) -> bool
pub fn is_responsible_source_path(&self, file_path: &Path) -> bool
Return true when SCOPE owns semantic source operations for this path.