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 fa18703e1..d00a8b6e7 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; |
@@ -138,6 +138,20 @@ impl IntoIterator for SearchScope { | |||
138 | impl Definition { | 138 | impl Definition { |
139 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { | 139 | fn search_scope(&self, db: &RootDatabase) -> SearchScope { |
140 | let _p = profile::span("search_scope"); | 140 | let _p = profile::span("search_scope"); |
141 | |||
142 | if let Definition::ModuleDef(hir::ModuleDef::BuiltinType(_)) = self { | ||
143 | let mut res = FxHashMap::default(); | ||
144 | |||
145 | let graph = db.crate_graph(); | ||
146 | for krate in graph.iter() { | ||
147 | let root_file = graph[krate].root_file_id; | ||
148 | let source_root_id = db.file_source_root(root_file); | ||
149 | let source_root = db.source_root(source_root_id); | ||
150 | res.extend(source_root.iter().map(|id| (id, None))); | ||
151 | } | ||
152 | return SearchScope::new(res); | ||
153 | } | ||
154 | |||
141 | let module = match self.module(db) { | 155 | let module = match self.module(db) { |
142 | Some(it) => it, | 156 | Some(it) => it, |
143 | None => return SearchScope::empty(), | 157 | None => return SearchScope::empty(), |