pub(crate) fn find_all_refs(
sema: &Semantics<'_, RootDatabase>,
position: FilePosition,
config: &FindAllRefsConfig<'_>,
) -> Option<Vec<ReferenceSearchResult>>Expand description
Find all references to the item at the given position.
§Arguments
sema- Semantic analysis contextposition- Position in the file where to look for the itemsearch_scope- Optional scope to limit the search (e.g. current crate only)
§Returns
Returns None if no valid item is found at the position.
Otherwise returns a vector of ReferenceSearchResult, usually with one element.
Multiple results can occur in case of ambiguity or when searching for trait items.
§Special cases
- Control flow keywords (break, continue, etc): Shows all related jump points
- Constructor search: When on struct/enum definition tokens (
{,(,;), shows only initialization sites - Format string arguments: Shows template parameter usages
- Lifetime parameters: Shows lifetime constraint usages
§Constructor search
When the cursor is on specific tokens in a struct/enum definition:
{after struct/enum/variant: Shows record literal initializations(after tuple struct/variant: Shows tuple literal initializations;after unit struct: Shows unit literal initializations- Type name in definition: Shows all initialization usages In these cases, other kinds of references (like type references) are filtered out.