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:
Aleksey Kladov 2020-08-19 18:58:48 +02:00
parent 686a6a26fd
commit 81b0976187
5 changed files with 41 additions and 17 deletions

View file

@ -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();