mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Future proof find-usages API
We might want to provide more efficient impls for check if usages exist, limiting the search, filtering and cancellation, so let's violate YAGNI a bit here.
This commit is contained in:
parent
686a6a26fd
commit
81b0976187
5 changed files with 41 additions and 17 deletions
|
@ -106,7 +106,9 @@ pub(crate) fn find_all_refs(
|
|||
let RangeInfo { range, info: def } = find_name(&sema, &syntax, position, opt_name)?;
|
||||
|
||||
let references = def
|
||||
.find_usages(sema, search_scope)
|
||||
.usages(sema)
|
||||
.set_scope(search_scope)
|
||||
.all()
|
||||
.into_iter()
|
||||
.filter(|r| search_kind == ReferenceKind::Other || search_kind == r.kind)
|
||||
.collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue