aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/db.rs')
-rw-r--r--crates/ra_analysis/src/db.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs
index 4c9c84e4f..0901c2bba 100644
--- a/crates/ra_analysis/src/db.rs
+++ b/crates/ra_analysis/src/db.rs
@@ -7,7 +7,7 @@ use salsa::{self, Database};
7 7
8use crate::{ 8use crate::{
9 hir, 9 hir,
10 symbol_index::SymbolIndex, 10 symbol_index,
11 loc2id::{IdMaps}, 11 loc2id::{IdMaps},
12 Cancelable, Canceled, FileId, 12 Cancelable, Canceled, FileId,
13}; 13};
@@ -114,23 +114,25 @@ salsa::database_storage! {
114 fn file_source_root() for crate::input::FileSourceRootQuery; 114 fn file_source_root() for crate::input::FileSourceRootQuery;
115 fn source_root() for crate::input::SourceRootQuery; 115 fn source_root() for crate::input::SourceRootQuery;
116 fn libraries() for crate::input::LibrariesQuery; 116 fn libraries() for crate::input::LibrariesQuery;
117 fn library_symbols() for crate::input::LibrarySymbolsQuery;
118 fn crate_graph() for crate::input::CrateGraphQuery; 117 fn crate_graph() for crate::input::CrateGraphQuery;
119 } 118 }
120 impl SyntaxDatabase { 119 impl SyntaxDatabase {
121 fn file_syntax() for FileSyntaxQuery; 120 fn file_syntax() for FileSyntaxQuery;
122 fn file_lines() for FileLinesQuery; 121 fn file_lines() for FileLinesQuery;
123 fn file_symbols() for FileSymbolsQuery; 122 }
123 impl symbol_index::SymbolsDatabase {
124 fn file_symbols() for symbol_index::FileSymbolsQuery;
125 fn library_symbols() for symbol_index::LibrarySymbolsQuery;
124 } 126 }
125 impl hir::db::HirDatabase { 127 impl hir::db::HirDatabase {
126 fn module_tree() for hir::db::ModuleTreeQuery; 128 fn module_tree() for hir::db::ModuleTreeQuery;
127 fn fn_scopes() for hir::db::FnScopesQuery; 129 fn fn_scopes() for hir::db::FnScopesQuery;
128 fn _file_items() for hir::db::SourceFileItemsQuery; 130 fn file_items() for hir::db::SourceFileItemsQuery;
129 fn _file_item() for hir::db::FileItemQuery; 131 fn file_item() for hir::db::FileItemQuery;
130 fn _input_module_items() for hir::db::InputModuleItemsQuery; 132 fn input_module_items() for hir::db::InputModuleItemsQuery;
131 fn _item_map() for hir::db::ItemMapQuery; 133 fn item_map() for hir::db::ItemMapQuery;
132 fn _fn_syntax() for hir::db::FnSyntaxQuery; 134 fn fn_syntax() for hir::db::FnSyntaxQuery;
133 fn _submodules() for hir::db::SubmodulesQuery; 135 fn submodules() for hir::db::SubmodulesQuery;
134 } 136 }
135 } 137 }
136} 138}
@@ -143,9 +145,6 @@ salsa::query_group! {
143 fn file_lines(file_id: FileId) -> Arc<LineIndex> { 145 fn file_lines(file_id: FileId) -> Arc<LineIndex> {
144 type FileLinesQuery; 146 type FileLinesQuery;
145 } 147 }
146 fn file_symbols(file_id: FileId) -> Cancelable<Arc<SymbolIndex>> {
147 type FileSymbolsQuery;
148 }
149 } 148 }
150} 149}
151 150
@@ -157,8 +156,3 @@ fn file_lines(db: &impl SyntaxDatabase, file_id: FileId) -> Arc<LineIndex> {
157 let text = db.file_text(file_id); 156 let text = db.file_text(file_id);
158 Arc::new(LineIndex::new(&*text)) 157 Arc::new(LineIndex::new(&*text))
159} 158}
160fn file_symbols(db: &impl SyntaxDatabase, file_id: FileId) -> Cancelable<Arc<SymbolIndex>> {
161 db.check_canceled()?;
162 let syntax = db.file_syntax(file_id);
163 Ok(Arc::new(SymbolIndex::for_file(file_id, syntax)))
164}