diff options
Diffstat (limited to 'crates/ide_db/src/search.rs')
-rw-r--r-- | crates/ide_db/src/search.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index ddcfbd3f3..1615d407e 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | use std::{convert::TryInto, mem}; | 7 | use std::{convert::TryInto, mem}; |
8 | 8 | ||
9 | use base_db::{FileId, FileRange, SourceDatabaseExt}; | 9 | use base_db::{FileId, FileRange, SourceDatabase, SourceDatabaseExt}; |
10 | use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; | 10 | use hir::{DefWithBody, HasSource, Module, ModuleSource, Semantics, Visibility}; |
11 | use once_cell::unsync::Lazy; | 11 | use once_cell::unsync::Lazy; |
12 | use rustc_hash::FxHashMap; | 12 | use rustc_hash::FxHashMap; |
@@ -134,6 +134,20 @@ impl IntoIterator for SearchScope { | |||
134 | impl Definition { | 134 | impl Definition { |
135 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { | 135 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { |
136 | let _p = profile::span("search_scope"); | 136 | let _p = profile::span("search_scope"); |
137 | |||
138 | if let Definition::ModuleDef(hir::ModuleDef::BuiltinType(_)) = self { | ||
139 | let mut res = FxHashMap::default(); | ||
140 | |||
141 | let graph = db.crate_graph(); | ||
142 | for krate in graph.iter() { | ||
143 | let root_file = graph[krate].root_file_id; | ||
144 | let source_root_id = db.file_source_root(root_file); | ||
145 | let source_root = db.source_root(source_root_id); | ||
146 | res.extend(source_root.iter().map(|id| (id, None))); | ||
147 | } | ||
148 | return SearchScope::new(res); | ||
149 | } | ||
150 | |||
137 | let module = match self.module(db) { | 151 | let module = match self.module(db) { |
138 | Some(it) => it, | 152 | Some(it) => it, |
139 | None => return SearchScope::empty(), | 153 | None => return SearchScope::empty(), |