aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/db.rs56
-rw-r--r--crates/ra_ide_api/src/status.rs2
2 files changed, 8 insertions, 50 deletions
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index 11305613c..f0190ae51 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -7,6 +7,13 @@ use ra_db::{
7 7
8use crate::{symbol_index, LineIndex}; 8use crate::{symbol_index, LineIndex};
9 9
10#[salsa::database(
11 ra_db::FilesDatabase,
12 ra_db::SyntaxDatabase,
13 LineIndexDatabase,
14 symbol_index::SymbolsDatabase,
15 hir::db::HirDatabase
16)]
10#[derive(Debug)] 17#[derive(Debug)]
11pub(crate) struct RootDatabase { 18pub(crate) struct RootDatabase {
12 runtime: salsa::Runtime<RootDatabase>, 19 runtime: salsa::Runtime<RootDatabase>,
@@ -64,52 +71,3 @@ fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc<LineIndex>
64 let text = db.file_text(file_id); 71 let text = db.file_text(file_id);
65 Arc::new(LineIndex::new(&*text)) 72 Arc::new(LineIndex::new(&*text))
66} 73}
67
68salsa::database_storage! {
69 pub(crate) struct RootDatabaseStorage for RootDatabase {
70 impl ra_db::FilesDatabase {
71 fn file_text() for ra_db::FileTextQuery;
72 fn file_relative_path() for ra_db::FileRelativePathQuery;
73 fn file_source_root() for ra_db::FileSourceRootQuery;
74 fn source_root() for ra_db::SourceRootQuery;
75 fn source_root_crates() for ra_db::SourceRootCratesQuery;
76 fn local_roots() for ra_db::LocalRootsQuery;
77 fn library_roots() for ra_db::LibraryRootsQuery;
78 fn crate_graph() for ra_db::CrateGraphQuery;
79 }
80 impl ra_db::SyntaxDatabase {
81 fn source_file() for ra_db::SourceFileQuery;
82 }
83 impl LineIndexDatabase {
84 fn line_index() for LineIndexQuery;
85 }
86 impl symbol_index::SymbolsDatabase {
87 fn file_symbols() for symbol_index::FileSymbolsQuery;
88 fn library_symbols() for symbol_index::LibrarySymbolsQuery;
89 }
90 impl hir::db::HirDatabase {
91 fn hir_source_file() for hir::db::HirSourceFileQuery;
92 fn expand_macro_invocation() for hir::db::ExpandMacroInvocationQuery;
93 fn module_tree() for hir::db::ModuleTreeQuery;
94 fn fn_scopes() for hir::db::FnScopesQuery;
95 fn file_items() for hir::db::FileItemsQuery;
96 fn file_item() for hir::db::FileItemQuery;
97 fn lower_module() for hir::db::LowerModuleQuery;
98 fn lower_module_module() for hir::db::LowerModuleModuleQuery;
99 fn lower_module_source_map() for hir::db::LowerModuleSourceMapQuery;
100 fn item_map() for hir::db::ItemMapQuery;
101 fn submodules() for hir::db::SubmodulesQuery;
102 fn infer() for hir::db::InferQuery;
103 fn type_for_def() for hir::db::TypeForDefQuery;
104 fn type_for_field() for hir::db::TypeForFieldQuery;
105 fn struct_data() for hir::db::StructDataQuery;
106 fn enum_data() for hir::db::EnumDataQuery;
107 fn impls_in_module() for hir::db::ImplsInModuleQuery;
108 fn impls_in_crate() for hir::db::ImplsInCrateQuery;
109 fn body_hir() for hir::db::BodyHirQuery;
110 fn body_syntax_mapping() for hir::db::BodySyntaxMappingQuery;
111 fn fn_signature() for hir::db::FnSignatureQuery;
112 fn generic_params() for hir::db::GenericParamsQuery;
113 }
114 }
115}
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs
index 5c14cbdeb..d499dd878 100644
--- a/crates/ra_ide_api/src/status.rs
+++ b/crates/ra_ide_api/src/status.rs
@@ -6,7 +6,7 @@ use ra_db::{
6use crate::db::RootDatabase; 6use crate::db::RootDatabase;
7 7
8pub(crate) fn status(db: &RootDatabase) -> String { 8pub(crate) fn status(db: &RootDatabase) -> String {
9 let n_parsed_files = db.query(SourceFileQuery).keys::<Vec<_>>().len(); 9 let n_parsed_files = db.query(SourceFileQuery).entries::<Vec<_>>().len();
10 let n_defs = { 10 let n_defs = {
11 let interner: &hir::HirInterner = db.as_ref(); 11 let interner: &hir::HirInterner = db.as_ref();
12 interner.len() 12 interner.len()