diff options
Diffstat (limited to 'crates/ide_db/src/search.rs')
-rw-r--r-- | crates/ide_db/src/search.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 0ecb13a64..b9ba0aed5 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
@@ -228,6 +228,15 @@ impl Definition { | |||
228 | // so do nothing. | 228 | // so do nothing. |
229 | } | 229 | } |
230 | } | 230 | } |
231 | ModuleSource::BlockExpr(b) => { | ||
232 | if is_first { | ||
233 | let range = Some(b.syntax().text_range()); | ||
234 | res.insert(file_id, range); | ||
235 | } else { | ||
236 | // We have already added the enclosing file to the search scope, | ||
237 | // so do nothing. | ||
238 | } | ||
239 | } | ||
231 | ModuleSource::SourceFile(_) => { | 240 | ModuleSource::SourceFile(_) => { |
232 | res.insert(file_id, None); | 241 | res.insert(file_id, None); |
233 | } | 242 | } |
@@ -257,6 +266,7 @@ impl Definition { | |||
257 | let mut res = FxHashMap::default(); | 266 | let mut res = FxHashMap::default(); |
258 | let range = match module_src.value { | 267 | let range = match module_src.value { |
259 | ModuleSource::Module(m) => Some(m.syntax().text_range()), | 268 | ModuleSource::Module(m) => Some(m.syntax().text_range()), |
269 | ModuleSource::BlockExpr(b) => Some(b.syntax().text_range()), | ||
260 | ModuleSource::SourceFile(_) => None, | 270 | ModuleSource::SourceFile(_) => None, |
261 | }; | 271 | }; |
262 | res.insert(file_id, range); | 272 | res.insert(file_id, range); |