aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/imports_locator.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-16 17:52:29 +0000
committerGitHub <[email protected]>2021-01-16 17:52:29 +0000
commit9a349f280ff1c6d0b57df80aa3d6720474e4b00a (patch)
tree23bbb365f31438949358a576bc9467fa70fa874e /crates/ide_db/src/imports_locator.rs
parent3782c78d7558633be5483a04aa1c098fe76100b9 (diff)
parent497fc232e7d90d8d39c7a13742dd85d758dc2f72 (diff)
Merge #7295
7295: Share import_assets and related entities r=matklad a=SomeoneToIgnore Part of https://github.com/rust-analyzer/rust-analyzer/pull/7293 Addresses https://github.com/rust-analyzer/rust-analyzer/pull/7293#issuecomment-761569558 Prepares `import_assets` and related to be used later for the trait fuzzy importing. Also moves fuzzy imports into a separate completion module and renames them, as suggested in https://github.com/rust-analyzer/rust-analyzer/pull/7293#discussion_r558896685 Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ide_db/src/imports_locator.rs')
-rw-r--r--crates/ide_db/src/imports_locator.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs
index e9f23adf8..d111fba92 100644
--- a/crates/ide_db/src/imports_locator.rs
+++ b/crates/ide_db/src/imports_locator.rs
@@ -12,6 +12,8 @@ use crate::{
12use either::Either; 12use either::Either;
13use rustc_hash::FxHashSet; 13use rustc_hash::FxHashSet;
14 14
15const QUERY_SEARCH_LIMIT: usize = 40;
16
15pub fn find_exact_imports<'a>( 17pub fn find_exact_imports<'a>(
16 sema: &Semantics<'a, RootDatabase>, 18 sema: &Semantics<'a, RootDatabase>,
17 krate: Crate, 19 krate: Crate,
@@ -24,11 +26,11 @@ pub fn find_exact_imports<'a>(
24 { 26 {
25 let mut local_query = symbol_index::Query::new(name_to_import.clone()); 27 let mut local_query = symbol_index::Query::new(name_to_import.clone());
26 local_query.exact(); 28 local_query.exact();
27 local_query.limit(40); 29 local_query.limit(QUERY_SEARCH_LIMIT);
28 local_query 30 local_query
29 }, 31 },
30 import_map::Query::new(name_to_import) 32 import_map::Query::new(name_to_import)
31 .limit(40) 33 .limit(QUERY_SEARCH_LIMIT)
32 .name_only() 34 .name_only()
33 .search_mode(import_map::SearchMode::Equals) 35 .search_mode(import_map::SearchMode::Equals)
34 .case_sensitive(), 36 .case_sensitive(),