mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Tweak the search query params for better lookup speed
This commit is contained in:
parent
cbd3717f2c
commit
bf24cb3e8d
2 changed files with 38 additions and 32 deletions
|
@ -34,6 +34,7 @@ pub fn find_exact_imports<'a>(
|
|||
pub fn find_similar_imports<'a>(
|
||||
sema: &Semantics<'a, RootDatabase>,
|
||||
krate: Crate,
|
||||
limit: Option<usize>,
|
||||
name_to_import: &str,
|
||||
ignore_modules: bool,
|
||||
) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> {
|
||||
|
@ -44,7 +45,14 @@ pub fn find_similar_imports<'a>(
|
|||
external_query = external_query.exclude_import_kind(import_map::ImportKind::Module);
|
||||
}
|
||||
|
||||
find_imports(sema, krate, symbol_index::Query::new(name_to_import.to_string()), external_query)
|
||||
let mut local_query = symbol_index::Query::new(name_to_import.to_string());
|
||||
|
||||
if let Some(limit) = limit {
|
||||
local_query.limit(limit);
|
||||
external_query = external_query.limit(limit);
|
||||
}
|
||||
|
||||
find_imports(sema, krate, local_query, external_query)
|
||||
}
|
||||
|
||||
fn find_imports<'a>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue