11//! This module contains an import search funcionality that is provided to the assists module.
22//! Later, this should be moved away to a separate crate that is accessible from the assists module.
33
4- use hir:: { Crate , ExternalImportablesQuery , MacroDef , ModuleDef , Semantics } ;
4+ use hir:: { import_map , Crate , MacroDef , ModuleDef , Semantics } ;
55use syntax:: { ast, AstNode , SyntaxKind :: NAME } ;
66
77use crate :: {
88 defs:: { Definition , NameClass } ,
9- symbol_index:: { self , FileSymbol , Query as LocalImportablesQuery } ,
9+ symbol_index:: { self , FileSymbol } ,
1010 RootDatabase ,
1111} ;
1212use either:: Either ;
@@ -22,12 +22,12 @@ pub fn find_exact_imports<'a>(
2222 sema,
2323 krate,
2424 {
25- let mut local_query = LocalImportablesQuery :: new ( name_to_import. to_string ( ) ) ;
25+ let mut local_query = symbol_index :: Query :: new ( name_to_import. to_string ( ) ) ;
2626 local_query. exact ( ) ;
2727 local_query. limit ( 40 ) ;
2828 local_query
2929 } ,
30- ExternalImportablesQuery :: new ( name_to_import) . anchor_end ( ) . case_sensitive ( ) . limit ( 40 ) ,
30+ import_map :: Query :: new ( name_to_import) . anchor_end ( ) . case_sensitive ( ) . limit ( 40 ) ,
3131 )
3232}
3333
@@ -42,19 +42,19 @@ pub fn find_similar_imports<'a>(
4242 sema,
4343 krate,
4444 {
45- let mut local_query = LocalImportablesQuery :: new ( name_to_import. to_string ( ) ) ;
45+ let mut local_query = symbol_index :: Query :: new ( name_to_import. to_string ( ) ) ;
4646 local_query. limit ( limit) ;
4747 local_query
4848 } ,
49- ExternalImportablesQuery :: new ( name_to_import) . limit ( limit) ,
49+ import_map :: Query :: new ( name_to_import) . limit ( limit) ,
5050 )
5151}
5252
5353fn find_imports < ' a > (
5454 sema : & Semantics < ' a , RootDatabase > ,
5555 krate : Crate ,
56- local_query : LocalImportablesQuery ,
57- external_query : ExternalImportablesQuery ,
56+ local_query : symbol_index :: Query ,
57+ external_query : import_map :: Query ,
5858) -> impl Iterator < Item = Either < ModuleDef , MacroDef > > {
5959 let _p = profile:: span ( "find_similar_imports" ) ;
6060 let db = sema. db ;
0 commit comments