diff options
author | Kirill Bulatov <[email protected]> | 2020-12-28 09:41:08 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-12-28 13:06:10 +0000 |
commit | 0e48cd0c3c712cea0267476de974012b2b05b508 (patch) | |
tree | e8b0e719409110f077e72a34242e9853e5fc5031 /crates/ide_db/src | |
parent | 77ad203a719be074e81485af7a4fb02fac6cbf61 (diff) |
Draft the module exclusion in modules
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/imports_locator.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs index b2980a5d6..0de949b9a 100644 --- a/crates/ide_db/src/imports_locator.rs +++ b/crates/ide_db/src/imports_locator.rs | |||
@@ -27,7 +27,12 @@ pub fn find_exact_imports<'a>( | |||
27 | local_query.limit(40); | 27 | local_query.limit(40); |
28 | local_query | 28 | local_query |
29 | }, | 29 | }, |
30 | import_map::Query::new(name_to_import).anchor_end().case_sensitive().limit(40), | 30 | import_map::Query::new(name_to_import) |
31 | .limit(40) | ||
32 | .name_only() | ||
33 | .name_end() | ||
34 | .strict_include() | ||
35 | .case_sensitive(), | ||
31 | ) | 36 | ) |
32 | } | 37 | } |
33 | 38 | ||
@@ -36,11 +41,12 @@ pub fn find_similar_imports<'a>( | |||
36 | krate: Crate, | 41 | krate: Crate, |
37 | limit: Option<usize>, | 42 | limit: Option<usize>, |
38 | name_to_import: &str, | 43 | name_to_import: &str, |
44 | // TODO kb change it to search across the whole path or not? | ||
39 | ignore_modules: bool, | 45 | ignore_modules: bool, |
40 | ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { | 46 | ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { |
41 | let _p = profile::span("find_similar_imports"); | 47 | let _p = profile::span("find_similar_imports"); |
42 | 48 | ||
43 | let mut external_query = import_map::Query::new(name_to_import); | 49 | let mut external_query = import_map::Query::new(name_to_import).name_only(); |
44 | if ignore_modules { | 50 | if ignore_modules { |
45 | external_query = external_query.exclude_import_kind(import_map::ImportKind::Module); | 51 | external_query = external_query.exclude_import_kind(import_map::ImportKind::Module); |
46 | } | 52 | } |