diff options
Diffstat (limited to 'crates/ide_db/src')
-rw-r--r-- | crates/ide_db/src/imports_locator.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs index df74be00b..e4f4b5427 100644 --- a/crates/ide_db/src/imports_locator.rs +++ b/crates/ide_db/src/imports_locator.rs | |||
@@ -1,12 +1,12 @@ | |||
1 | //! This module contains an import search funcionality that is provided to the assists module. | 1 | //! This module contains an import search funcionality that is provided to the assists module. |
2 | //! Later, this should be moved away to a separate crate that is accessible from the assists module. | 2 | //! Later, this should be moved away to a separate crate that is accessible from the assists module. |
3 | 3 | ||
4 | use hir::{Crate, MacroDef, ModuleDef, Semantics}; | 4 | use hir::{Crate, MacroDef, ModuleDef, Query as ImportMapQuery, Semantics}; |
5 | use syntax::{ast, AstNode, SyntaxKind::NAME}; | 5 | use syntax::{ast, AstNode, SyntaxKind::NAME}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | defs::{Definition, NameClass}, | 8 | defs::{Definition, NameClass}, |
9 | symbol_index::{self, FileSymbol, Query}, | 9 | symbol_index::{self, FileSymbol, Query as SymbolQuery}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
12 | use either::Either; | 12 | use either::Either; |
@@ -21,12 +21,16 @@ pub fn find_imports<'a>( | |||
21 | let db = sema.db; | 21 | let db = sema.db; |
22 | 22 | ||
23 | // Query dependencies first. | 23 | // Query dependencies first. |
24 | let mut candidates: FxHashSet<_> = | 24 | let mut candidates: FxHashSet<_> = krate |
25 | krate.query_external_importables(db, name_to_import).collect(); | 25 | .query_external_importables( |
26 | db, | ||
27 | ImportMapQuery::new(name_to_import).anchor_end().case_sensitive().limit(40), | ||
28 | ) | ||
29 | .collect(); | ||
26 | 30 | ||
27 | // Query the local crate using the symbol index. | 31 | // Query the local crate using the symbol index. |
28 | let local_results = { | 32 | let local_results = { |
29 | let mut query = Query::new(name_to_import.to_string()); | 33 | let mut query = SymbolQuery::new(name_to_import.to_string()); |
30 | query.exact(); | 34 | query.exact(); |
31 | query.limit(40); | 35 | query.limit(40); |
32 | symbol_index::crate_symbols(db, krate.into(), query) | 36 | symbol_index::crate_symbols(db, krate.into(), query) |