LanguageExtractor

Trait LanguageExtractor 

Source
pub trait LanguageExtractor: Send + Sync {
    // Required methods
    fn language(&self) -> Language;
    fn name(&self) -> &'static str;
    fn extensions(&self) -> &'static [&'static str];
    fn extract_symbols(
        &self,
        tree: &Tree,
        source: &str,
    ) -> Result<Vec<ExtractedSymbol>>;
    fn extract_imports(&self, tree: &Tree, source: &str) -> Result<Vec<Import>>;
    fn extract_calls(
        &self,
        tree: &Tree,
        source: &str,
        current_function: Option<&str>,
    ) -> Result<Vec<FunctionCall>>;
    fn extract_doc_comment(
        &self,
        node: &Node<'_>,
        source: &str,
    ) -> Option<String>;
}
Expand description

Trait for language-specific symbol extraction

Required Methods§

Source

fn language(&self) -> Language

Get the tree-sitter language

Source

fn name(&self) -> &'static str

Get the language name

Source

fn extensions(&self) -> &'static [&'static str]

Get file extensions for this language

Source

fn extract_symbols( &self, tree: &Tree, source: &str, ) -> Result<Vec<ExtractedSymbol>>

Extract symbols from a parsed AST

Source

fn extract_imports(&self, tree: &Tree, source: &str) -> Result<Vec<Import>>

Extract import statements from a parsed AST

Source

fn extract_calls( &self, tree: &Tree, source: &str, current_function: Option<&str>, ) -> Result<Vec<FunctionCall>>

Extract function calls from a parsed AST

Source

fn extract_doc_comment(&self, node: &Node<'_>, source: &str) -> Option<String>

Extract doc comment for a node (language-specific comment syntax)

Implementors§