move ide queries to ide db
This commit is contained in:
parent
be1a005ebd
commit
3223de5976
4 changed files with 14 additions and 19 deletions
|
@ -80,14 +80,6 @@ pub trait FilesDatabase: salsa::Database + CheckCanceled {
|
|||
#[salsa::input]
|
||||
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
|
||||
fn source_root_crates(&self, id: SourceRootId) -> Arc<Vec<CrateId>>;
|
||||
/// The set of "local" (that is, from the current workspace) roots.
|
||||
/// Files in local roots are assumed to change frequently.
|
||||
#[salsa::input]
|
||||
fn local_roots(&self) -> Arc<Vec<SourceRootId>>;
|
||||
/// The set of roots for crates.io libraries.
|
||||
/// Files in libraries are assumed to never change.
|
||||
#[salsa::input]
|
||||
fn library_roots(&self) -> Arc<Vec<SourceRootId>>;
|
||||
/// The crate graph.
|
||||
#[salsa::input]
|
||||
fn crate_graph(&self) -> Arc<CrateGraph>;
|
||||
|
|
|
@ -140,8 +140,6 @@ impl Default for MockDatabase {
|
|||
file_counter: 0,
|
||||
};
|
||||
db.set_crate_graph(Default::default());
|
||||
db.set_local_roots(Default::default());
|
||||
db.set_library_roots(Default::default());
|
||||
db
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use ra_db::{
|
||||
CheckCanceled, FileId, Canceled,
|
||||
salsa::{self, Database},
|
||||
CheckCanceled, FileId, Canceled, FilesDatabase,
|
||||
salsa,
|
||||
};
|
||||
|
||||
use crate::{symbol_index, LineIndex};
|
||||
use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}};
|
||||
|
||||
#[salsa::database(
|
||||
ra_db::FilesDatabaseStorage,
|
||||
|
@ -34,12 +34,9 @@ impl Default for RootDatabase {
|
|||
runtime: salsa::Runtime::default(),
|
||||
interner: Default::default(),
|
||||
};
|
||||
db.query_mut(ra_db::CrateGraphQuery)
|
||||
.set((), Default::default());
|
||||
db.query_mut(ra_db::LocalRootsQuery)
|
||||
.set((), Default::default());
|
||||
db.query_mut(ra_db::LibraryRootsQuery)
|
||||
.set((), Default::default());
|
||||
db.set_crate_graph(Default::default());
|
||||
db.set_local_roots(Default::default());
|
||||
db.set_library_roots(Default::default());
|
||||
db
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,14 @@ pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {
|
|||
fn file_symbols(&self, file_id: FileId) -> Arc<SymbolIndex>;
|
||||
#[salsa::input]
|
||||
fn library_symbols(&self, id: SourceRootId) -> Arc<SymbolIndex>;
|
||||
/// The set of "local" (that is, from the current workspace) roots.
|
||||
/// Files in local roots are assumed to change frequently.
|
||||
#[salsa::input]
|
||||
fn local_roots(&self) -> Arc<Vec<SourceRootId>>;
|
||||
/// The set of roots for crates.io libraries.
|
||||
/// Files in libraries are assumed to never change.
|
||||
#[salsa::input]
|
||||
fn library_roots(&self) -> Arc<Vec<SourceRootId>>;
|
||||
}
|
||||
|
||||
fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> {
|
||||
|
|
Loading…
Add table
Reference in a new issue