diff options
author | Aleksey Kladov <[email protected]> | 2019-01-26 08:20:30 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-26 08:20:30 +0000 |
commit | 4711cbcace33e34d43f880d30c2778c843240f27 (patch) | |
tree | 7aae7fff41fcc67523f1f0b7a0fc06a174d00394 /crates/ra_db | |
parent | 3223de59765cae816099e8684a2caf13bc69bb2e (diff) |
rename FilesDatabase -> SourceDatabase
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index cab47dcac..2664dc69a 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -63,8 +63,10 @@ pub struct FileRange { | |||
63 | pub range: TextRange, | 63 | pub range: TextRange, |
64 | } | 64 | } |
65 | 65 | ||
66 | #[salsa::query_group(FilesDatabaseStorage)] | 66 | /// Database which stores all significant input facts: source code and project |
67 | pub trait FilesDatabase: salsa::Database + CheckCanceled { | 67 | /// model. Everything else in rust-analyzer is derived from these queries. |
68 | #[salsa::query_group(SourceDatabaseStorage)] | ||
69 | pub trait SourceDatabase: salsa::Database + CheckCanceled { | ||
68 | /// Text of the file. | 70 | /// Text of the file. |
69 | #[salsa::input] | 71 | #[salsa::input] |
70 | fn file_text(&self, file_id: FileId) -> Arc<String>; | 72 | fn file_text(&self, file_id: FileId) -> Arc<String>; |
@@ -85,7 +87,7 @@ pub trait FilesDatabase: salsa::Database + CheckCanceled { | |||
85 | fn crate_graph(&self) -> Arc<CrateGraph>; | 87 | fn crate_graph(&self) -> Arc<CrateGraph>; |
86 | } | 88 | } |
87 | 89 | ||
88 | fn source_root_crates(db: &impl FilesDatabase, id: SourceRootId) -> Arc<Vec<CrateId>> { | 90 | fn source_root_crates(db: &impl SourceDatabase, id: SourceRootId) -> Arc<Vec<CrateId>> { |
89 | let root = db.source_root(id); | 91 | let root = db.source_root(id); |
90 | let graph = db.crate_graph(); | 92 | let graph = db.crate_graph(); |
91 | let res = root | 93 | let res = root |
@@ -96,7 +98,7 @@ fn source_root_crates(db: &impl FilesDatabase, id: SourceRootId) -> Arc<Vec<Crat | |||
96 | Arc::new(res) | 98 | Arc::new(res) |
97 | } | 99 | } |
98 | 100 | ||
99 | fn source_file(db: &impl FilesDatabase, file_id: FileId) -> TreeArc<SourceFile> { | 101 | fn source_file(db: &impl SourceDatabase, file_id: FileId) -> TreeArc<SourceFile> { |
100 | let text = db.file_text(file_id); | 102 | let text = db.file_text(file_id); |
101 | SourceFile::parse(&*text) | 103 | SourceFile::parse(&*text) |
102 | } | 104 | } |