pub struct TreeTool { /* private fields */ }Expand description
Enhanced tree-sitter tool with comprehensive language support
Implementations§
Source§impl TreeTool
impl TreeTool
Sourcepub fn new(intelligence_level: IntelligenceLevel) -> TreeResult<Self>
pub fn new(intelligence_level: IntelligenceLevel) -> TreeResult<Self>
Create a new enhanced tree tool instance
Sourcepub async fn parse(
&self,
code: String,
language: Option<SupportedLanguage>,
file_path: Option<PathBuf>,
) -> TreeResult<Arc<ParsedAst>>
pub async fn parse( &self, code: String, language: Option<SupportedLanguage>, file_path: Option<PathBuf>, ) -> TreeResult<Arc<ParsedAst>>
Parse source code into AST with enhanced caching
Sourcepub async fn query(
&self,
code: String,
language: Option<SupportedLanguage>,
pattern: String,
file_path: Option<PathBuf>,
) -> TreeResult<Vec<QueryMatch>>
pub async fn query( &self, code: String, language: Option<SupportedLanguage>, pattern: String, file_path: Option<PathBuf>, ) -> TreeResult<Vec<QueryMatch>>
Query AST with tree-sitter query patterns
Sourcepub async fn get_symbols(
&self,
code: String,
language: Option<SupportedLanguage>,
file_path: Option<PathBuf>,
) -> TreeResult<Vec<Symbol>>
pub async fn get_symbols( &self, code: String, language: Option<SupportedLanguage>, file_path: Option<PathBuf>, ) -> TreeResult<Vec<Symbol>>
Extract symbols from parsed AST
Sourcepub async fn diff(
&self,
old_code: String,
new_code: String,
language: Option<SupportedLanguage>,
) -> TreeResult<SemanticDiff>
pub async fn diff( &self, old_code: String, new_code: String, language: Option<SupportedLanguage>, ) -> TreeResult<SemanticDiff>
Compare two pieces of code semantically
Sourcepub async fn parse_file(&self, file_path: PathBuf) -> TreeResult<Arc<ParsedAst>>
pub async fn parse_file(&self, file_path: PathBuf) -> TreeResult<Arc<ParsedAst>>
Parse file and return AST
Sourcepub async fn query_file(
&self,
file_path: PathBuf,
pattern: String,
) -> TreeResult<Vec<QueryMatch>>
pub async fn query_file( &self, file_path: PathBuf, pattern: String, ) -> TreeResult<Vec<QueryMatch>>
Query file with pattern
Sourcepub async fn extract_symbols_from_file(
&self,
file_path: PathBuf,
) -> TreeResult<Vec<Symbol>>
pub async fn extract_symbols_from_file( &self, file_path: PathBuf, ) -> TreeResult<Vec<Symbol>>
Extract symbols from file
Sourcepub async fn diff_files(
&self,
old_file: PathBuf,
new_file: PathBuf,
) -> TreeResult<SemanticDiff>
pub async fn diff_files( &self, old_file: PathBuf, new_file: PathBuf, ) -> TreeResult<SemanticDiff>
Compare two files
Sourcepub fn clear_caches(&self) -> TreeResult<()>
pub fn clear_caches(&self) -> TreeResult<()>
Clear all caches
Trait Implementations§
Source§impl InternalTool for TreeTool
impl InternalTool for TreeTool
type Input = TreeInput
type Output = ComprehensiveToolOutput<TreeOutput>
type Error = TreeError
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
input: Self::Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
input: Self::Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with the given input
Source§fn metadata(&self) -> ToolMetadata
fn metadata(&self) -> ToolMetadata
Get tool metadata
Auto Trait Implementations§
impl Freeze for TreeTool
impl !RefUnwindSafe for TreeTool
impl Send for TreeTool
impl Sync for TreeTool
impl Unpin for TreeTool
impl !UnwindSafe for TreeTool
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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