diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index c8329d971..a55fe03a6 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -104,12 +104,16 @@ impl Crate { | |||
104 | db: &dyn DefDatabase, | 104 | db: &dyn DefDatabase, |
105 | query: &str, | 105 | query: &str, |
106 | ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { | 106 | ) -> impl Iterator<Item = Either<ModuleDef, MacroDef>> { |
107 | import_map::search_dependencies(db, self.into(), import_map::Query::new(query).anchor_end()) | 107 | import_map::search_dependencies( |
108 | .into_iter() | 108 | db, |
109 | .map(|item| match item { | 109 | self.into(), |
110 | ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()), | 110 | import_map::Query::new(query).anchor_end().limit(40), |
111 | ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()), | 111 | ) |
112 | }) | 112 | .into_iter() |
113 | .map(|item| match item { | ||
114 | ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id.into()), | ||
115 | ItemInNs::Macros(mac_id) => Either::Right(mac_id.into()), | ||
116 | }) | ||
113 | } | 117 | } |
114 | 118 | ||
115 | pub fn all(db: &dyn HirDatabase) -> Vec<Crate> { | 119 | pub fn all(db: &dyn HirDatabase) -> Vec<Crate> { |