pub struct CodeParser {
pub files: HashMap<PathBuf, String>,
pub parser: Parser,
}Expand description
Tree-sitter based code parser.
Fields§
§files: HashMap<PathBuf, String>§parser: ParserImplementations§
Source§impl CodeParser
impl CodeParser
Sourcepub fn get_language(&self, path: &Path) -> Option<Language>
pub fn get_language(&self, path: &Path) -> Option<Language>
Get the tree-sitter language for a file based on its extension.
Sourcepub fn get_query_content(
&self,
language: &Language,
query_name: &str,
) -> Result<&'static str>
pub fn get_query_content( &self, language: &Language, query_name: &str, ) -> Result<&'static str>
Get query content for a specific language and query type.
Sourcepub fn find_definition(
&mut self,
name: &str,
source_file: &Path,
) -> Result<Option<(PathBuf, Definition)>>
pub fn find_definition( &mut self, name: &str, source_file: &Path, ) -> Result<Option<(PathBuf, Definition)>>
Find a definition by name in a specific file.
Sourcepub fn find_calls(
&mut self,
name: &str,
) -> Result<Vec<(PathBuf, Definition, String)>>
pub fn find_calls( &mut self, name: &str, ) -> Result<Vec<(PathBuf, Definition, String)>>
Find all calls to a function/method by name across all loaded files.
Sourcepub fn find_bidirectional(
&mut self,
name: &str,
source_file: &Path,
) -> Result<Vec<(PathBuf, Definition)>>
pub fn find_bidirectional( &mut self, name: &str, source_file: &Path, ) -> Result<Vec<(PathBuf, Definition)>>
Find both definitions and references for bidirectional tracking.
Sourcepub fn build_context_from_file(&mut self, start_path: &Path) -> Result<Context>
pub fn build_context_from_file(&mut self, start_path: &Path) -> Result<Context>
Build context (definitions and references) from a file.
Trait Implementations§
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