pub struct CodeParser { /* private fields */ }Implementations§
Source§impl CodeParser
impl CodeParser
pub fn new() -> Result<Self>
Sourcepub fn detect_language(&self, path: &Path) -> Option<String>
pub fn detect_language(&self, path: &Path) -> Option<String>
Determine language from file extension
Sourcepub fn parse_file(&mut self, path: &Path) -> Result<CodeAST>
pub fn parse_file(&mut self, path: &Path) -> Result<CodeAST>
Parse a single file using tree-sitter and generate AST with size optimizations
Sourcepub fn create_simplified_ast(
&self,
path: &Path,
language: &str,
source_code: &str,
) -> Result<CodeAST>
pub fn create_simplified_ast( &self, path: &Path, language: &str, source_code: &str, ) -> Result<CodeAST>
Fallback method: Create a simplified AST using regex - optimized for size
Sourcepub fn extract_search_terms(&self, query: &str) -> Vec<String>
pub fn extract_search_terms(&self, query: &str) -> Vec<String>
Extract search terms from a query for grep search
Sourcepub fn parse_codebase(
&mut self,
root_dir: &Path,
query: &str,
) -> Result<Vec<CodeAST>>
pub fn parse_codebase( &mut self, root_dir: &Path, query: &str, ) -> Result<Vec<CodeAST>>
Parse an entire codebase and generate ASTs for selected files
Sourcepub fn generate_llm_friendly_ast(
&mut self,
root_dir: &Path,
query: &str,
) -> Result<String>
pub fn generate_llm_friendly_ast( &mut self, root_dir: &Path, query: &str, ) -> Result<String>
Generate a concise AST optimized for LLM consumption, respecting API size limits
Sourcepub fn determine_relevant_files(&self, query: &str) -> Vec<String>
pub fn determine_relevant_files(&self, query: &str) -> Vec<String>
Determine which files to parse based on user query
Auto Trait Implementations§
impl Freeze for CodeParser
impl RefUnwindSafe for CodeParser
impl Send for CodeParser
impl Sync for CodeParser
impl Unpin for CodeParser
impl UnsafeUnpin for CodeParser
impl UnwindSafe for CodeParser
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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