pub struct ReferenceQuery<'a> {
pub word: &'a str,
pub kind: Option<SymbolKind>,
pub target_fqn: Option<&'a str>,
pub owner_short: Option<&'a str>,
}Expand description
Unified reference collector used by textDocument/references.
Decides which path(s) to take — mir’s type-aware session index (fast, exact for methods), the AST walker (comprehensive), or both — and merges the results. All call sites previously duplicated this merge logic by hand.
Fields§
§word: &'a str§kind: Option<SymbolKind>§target_fqn: Option<&'a str>§owner_short: Option<&'a str>Short name of the owning class for method queries (e.g. "Widget" from
"App\\Widget"). Used to post-filter mir results to files that textually
mention the class, preventing false positives from same-name methods on
unrelated classes.
Implementations§
Source§impl<'a> ReferenceQuery<'a>
impl<'a> ReferenceQuery<'a>
Sourcepub fn collect(
&self,
docs: &DocumentStore,
candidate_urls: &[Url],
include_declaration: bool,
declaration_location: Option<Location>,
cancel_rev: Option<u64>,
) -> Vec<Location>
pub fn collect( &self, docs: &DocumentStore, candidate_urls: &[Url], include_declaration: bool, declaration_location: Option<Location>, cancel_rev: Option<u64>, ) -> Vec<Location>
Collect reference locations. candidate_urls should already be filtered
to files that mention self.word and narrowed by visibility (from
DocumentStore::candidate_urls_for + scope narrowing in the handler).
The method path hands the URLs straight to mir’s memoized analyze_file
query and never parses a ParsedDoc. The AST-walker path (non-method
kinds, or a method that mir couldn’t resolve) parses the candidates
lazily — only the files that actually reach the walker pay the parse.
declaration_location is the cursor span; it is appended to Method-path
results when include_declaration is true.
Auto Trait Implementations§
impl<'a> Freeze for ReferenceQuery<'a>
impl<'a> RefUnwindSafe for ReferenceQuery<'a>
impl<'a> Send for ReferenceQuery<'a>
impl<'a> Sync for ReferenceQuery<'a>
impl<'a> Unpin for ReferenceQuery<'a>
impl<'a> UnsafeUnpin for ReferenceQuery<'a>
impl<'a> UnwindSafe for ReferenceQuery<'a>
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
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>
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>
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