pub struct AstQuery { /* private fields */ }Expand description
AST 查询器:统一的 tree-sitter 查询接口
封装多种语言的 tree-sitter parser,提供符号定位和引用查询。
Implementations§
Source§impl AstQuery
impl AstQuery
Sourcepub fn find_definition(
&mut self,
source: &str,
symbol: &str,
) -> Result<Option<QueryMatch>>
pub fn find_definition( &mut self, source: &str, symbol: &str, ) -> Result<Option<QueryMatch>>
查找符号定义位置
手动遍历 AST,找到 name 与 symbol 匹配的顶层定义节点。 不依赖 tree-sitter Query API,兼容所有 tree-sitter 版本。
Auto Trait Implementations§
impl Freeze for AstQuery
impl RefUnwindSafe for AstQuery
impl Send for AstQuery
impl Sync for AstQuery
impl Unpin for AstQuery
impl UnsafeUnpin for AstQuery
impl UnwindSafe for AstQuery
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