diff options
Diffstat (limited to 'crates/ra_analysis/src/module_map.rs')
-rw-r--r-- | crates/ra_analysis/src/module_map.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs index 0c413becd..3c800265a 100644 --- a/crates/ra_analysis/src/module_map.rs +++ b/crates/ra_analysis/src/module_map.rs | |||
@@ -1,12 +1,13 @@ | |||
1 | use std::sync::Arc; | ||
2 | |||
1 | use crate::{ | 3 | use crate::{ |
4 | db, | ||
2 | Cancelable, | 5 | Cancelable, |
3 | db::SyntaxDatabase, | 6 | db::SyntaxDatabase, |
4 | descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, | 7 | descriptors::{ModuleDescriptor, ModuleTreeDescriptor}, |
5 | FileId, | 8 | FileId, |
6 | }; | 9 | }; |
7 | 10 | ||
8 | use std::sync::Arc; | ||
9 | |||
10 | salsa::query_group! { | 11 | salsa::query_group! { |
11 | pub(crate) trait ModulesDatabase: SyntaxDatabase { | 12 | pub(crate) trait ModulesDatabase: SyntaxDatabase { |
12 | fn module_tree() -> Cancelable<Arc<ModuleTreeDescriptor>> { | 13 | fn module_tree() -> Cancelable<Arc<ModuleTreeDescriptor>> { |
@@ -19,11 +20,13 @@ salsa::query_group! { | |||
19 | } | 20 | } |
20 | 21 | ||
21 | fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> { | 22 | fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Cancelable<Arc<ModuleDescriptor>> { |
23 | db::check_canceled(db)?; | ||
22 | let file = db.file_syntax(file_id); | 24 | let file = db.file_syntax(file_id); |
23 | Ok(Arc::new(ModuleDescriptor::new(file.ast()))) | 25 | Ok(Arc::new(ModuleDescriptor::new(file.ast()))) |
24 | } | 26 | } |
25 | 27 | ||
26 | fn module_tree(db: &impl ModulesDatabase) -> Cancelable<Arc<ModuleTreeDescriptor>> { | 28 | fn module_tree(db: &impl ModulesDatabase) -> Cancelable<Arc<ModuleTreeDescriptor>> { |
29 | db::check_canceled(db)?; | ||
27 | let file_set = db.file_set(); | 30 | let file_set = db.file_set(); |
28 | let mut files = Vec::new(); | 31 | let mut files = Vec::new(); |
29 | for &file_id in file_set.files.iter() { | 32 | for &file_id in file_set.files.iter() { |