pub struct TreeSitterAnalyzer { /* private fields */ }
Expand description
Main tree-sitter analyzer
Implementations§
Source§impl TreeSitterAnalyzer
impl TreeSitterAnalyzer
Sourcepub fn supported_languages(&self) -> &[LanguageSupport]
pub fn supported_languages(&self) -> &[LanguageSupport]
Get supported languages
Sourcepub fn detect_language_from_path<P: AsRef<Path>>(
&self,
path: P,
) -> Result<LanguageSupport>
pub fn detect_language_from_path<P: AsRef<Path>>( &self, path: P, ) -> Result<LanguageSupport>
Detect language from file extension
Sourcepub fn parse(
&mut self,
source_code: &str,
language: LanguageSupport,
) -> Result<Tree>
pub fn parse( &mut self, source_code: &str, language: LanguageSupport, ) -> Result<Tree>
Parse source code into a syntax tree
Sourcepub fn extract_symbols(
&mut self,
syntax_tree: &Tree,
source_code: &str,
language: LanguageSupport,
) -> Result<Vec<SymbolInfo>>
pub fn extract_symbols( &mut self, syntax_tree: &Tree, source_code: &str, language: LanguageSupport, ) -> Result<Vec<SymbolInfo>>
Extract symbols from a syntax tree
Sourcepub fn extract_dependencies(
&self,
syntax_tree: &Tree,
language: LanguageSupport,
) -> Result<Vec<DependencyInfo>>
pub fn extract_dependencies( &self, syntax_tree: &Tree, language: LanguageSupport, ) -> Result<Vec<DependencyInfo>>
Extract dependencies from a syntax tree
Sourcepub fn calculate_metrics(
&self,
syntax_tree: &Tree,
source_code: &str,
) -> Result<CodeMetrics>
pub fn calculate_metrics( &self, syntax_tree: &Tree, source_code: &str, ) -> Result<CodeMetrics>
Calculate code metrics from a syntax tree
Sourcepub fn parse_file<P: AsRef<Path>>(&mut self, file_path: P) -> Result<SyntaxTree>
pub fn parse_file<P: AsRef<Path>>(&mut self, file_path: P) -> Result<SyntaxTree>
Parse file into a syntax tree
Sourcepub fn convert_tree_to_syntax_node(
&self,
node: Node<'_>,
source_code: &str,
) -> SyntaxNode
pub fn convert_tree_to_syntax_node( &self, node: Node<'_>, source_code: &str, ) -> SyntaxNode
Convert tree-sitter node to our SyntaxNode
Sourcepub fn collect_diagnostics(
&self,
tree: &Tree,
_source_code: &str,
) -> Vec<Diagnostic>
pub fn collect_diagnostics( &self, tree: &Tree, _source_code: &str, ) -> Vec<Diagnostic>
Collect diagnostics from the parsed tree
Sourcepub fn get_parser_stats(&self) -> HashMap<String, usize>
pub fn get_parser_stats(&self) -> HashMap<String, usize>
Get parser statistics
pub fn analyze_file_with_tree_sitter( &mut self, file_path: &Path, source_code: &str, ) -> Result<CodeAnalysis>
Source§impl TreeSitterAnalyzer
impl TreeSitterAnalyzer
pub fn detect_language_from_content( &self, content: &str, ) -> Option<LanguageSupport>
Auto Trait Implementations§
impl Freeze for TreeSitterAnalyzer
impl RefUnwindSafe for TreeSitterAnalyzer
impl Send for TreeSitterAnalyzer
impl Sync for TreeSitterAnalyzer
impl Unpin for TreeSitterAnalyzer
impl UnwindSafe for TreeSitterAnalyzer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more