diff options
Diffstat (limited to 'crates/ra_ide_api/src/db.rs')
-rw-r--r-- | crates/ra_ide_api/src/db.rs | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index 30891aed4..3da93ec35 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs | |||
@@ -1,15 +1,14 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_db::{ | 3 | use ra_db::{ |
4 | BaseDatabase, FileId, Canceled, | 4 | CheckCanceled, FileId, Canceled, SourceDatabase, |
5 | salsa::{self, Database}, | 5 | salsa, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | use crate::{symbol_index, LineIndex}; | 8 | use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}}; |
9 | 9 | ||
10 | #[salsa::database( | 10 | #[salsa::database( |
11 | ra_db::FilesDatabaseStorage, | 11 | ra_db::SourceDatabaseStorage, |
12 | ra_db::SyntaxDatabaseStorage, | ||
13 | LineIndexDatabaseStorage, | 12 | LineIndexDatabaseStorage, |
14 | symbol_index::SymbolsDatabaseStorage, | 13 | symbol_index::SymbolsDatabaseStorage, |
15 | hir::db::HirDatabaseStorage | 14 | hir::db::HirDatabaseStorage |
@@ -35,12 +34,9 @@ impl Default for RootDatabase { | |||
35 | runtime: salsa::Runtime::default(), | 34 | runtime: salsa::Runtime::default(), |
36 | interner: Default::default(), | 35 | interner: Default::default(), |
37 | }; | 36 | }; |
38 | db.query_mut(ra_db::CrateGraphQuery) | 37 | db.set_crate_graph(Default::default()); |
39 | .set((), Default::default()); | 38 | db.set_local_roots(Default::default()); |
40 | db.query_mut(ra_db::LocalRootsQuery) | 39 | db.set_library_roots(Default::default()); |
41 | .set((), Default::default()); | ||
42 | db.query_mut(ra_db::LibraryRootsQuery) | ||
43 | .set((), Default::default()); | ||
44 | db | 40 | db |
45 | } | 41 | } |
46 | } | 42 | } |
@@ -54,7 +50,7 @@ impl salsa::ParallelDatabase for RootDatabase { | |||
54 | } | 50 | } |
55 | } | 51 | } |
56 | 52 | ||
57 | impl BaseDatabase for RootDatabase {} | 53 | impl CheckCanceled for RootDatabase {} |
58 | 54 | ||
59 | impl AsRef<hir::HirInterner> for RootDatabase { | 55 | impl AsRef<hir::HirInterner> for RootDatabase { |
60 | fn as_ref(&self) -> &hir::HirInterner { | 56 | fn as_ref(&self) -> &hir::HirInterner { |
@@ -63,11 +59,11 @@ impl AsRef<hir::HirInterner> for RootDatabase { | |||
63 | } | 59 | } |
64 | 60 | ||
65 | #[salsa::query_group(LineIndexDatabaseStorage)] | 61 | #[salsa::query_group(LineIndexDatabaseStorage)] |
66 | pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + BaseDatabase { | 62 | pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled { |
67 | fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; | 63 | fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; |
68 | } | 64 | } |
69 | 65 | ||
70 | fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc<LineIndex> { | 66 | fn line_index(db: &impl ra_db::SourceDatabase, file_id: FileId) -> Arc<LineIndex> { |
71 | let text = db.file_text(file_id); | 67 | let text = db.file_text(file_id); |
72 | Arc::new(LineIndex::new(&*text)) | 68 | Arc::new(LineIndex::new(&*text)) |
73 | } | 69 | } |