diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 09:16:07 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 09:16:07 +0000 |
commit | 9a16cf2bf646a4a881f3f5acbf5582dacc4337bf (patch) | |
tree | ff90eb390a8f5af47b6d0c6ec4c49b4431b82d1c /crates/ra_db/src/input.rs | |
parent | dbb62b5baa36783bbca06f09c77794fce3ceff0c (diff) | |
parent | a084412f0698d5f54d586f707930e141c88b0673 (diff) |
Merge #292
292: Vfs r=matklad a=matklad
closes #243
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_db/src/input.rs')
-rw-r--r-- | crates/ra_db/src/input.rs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index ac144b991..cccf37cc2 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -1,10 +1,12 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use rustc_hash::{FxHashSet, FxHashMap}; | 3 | use rustc_hash::{FxHashMap}; |
4 | use relative_path::RelativePathBuf; | ||
4 | use ra_syntax::SmolStr; | 5 | use ra_syntax::SmolStr; |
5 | use salsa; | 6 | use salsa; |
6 | 7 | ||
7 | use crate::file_resolver::FileResolverImp; | 8 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] |
9 | pub struct SourceRootId(pub u32); | ||
8 | 10 | ||
9 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 11 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
10 | pub struct FileId(pub u32); | 12 | pub struct FileId(pub u32); |
@@ -85,6 +87,11 @@ salsa::query_group! { | |||
85 | type FileTextQuery; | 87 | type FileTextQuery; |
86 | storage input; | 88 | storage input; |
87 | } | 89 | } |
90 | /// Path to a file, relative to the root of its source root. | ||
91 | fn file_relative_path(file_id: FileId) -> RelativePathBuf { | ||
92 | type FileRelativePathQuery; | ||
93 | storage input; | ||
94 | } | ||
88 | fn file_source_root(file_id: FileId) -> SourceRootId { | 95 | fn file_source_root(file_id: FileId) -> SourceRootId { |
89 | type FileSourceRootQuery; | 96 | type FileSourceRootQuery; |
90 | storage input; | 97 | storage input; |
@@ -93,8 +100,12 @@ salsa::query_group! { | |||
93 | type SourceRootQuery; | 100 | type SourceRootQuery; |
94 | storage input; | 101 | storage input; |
95 | } | 102 | } |
96 | fn libraries() -> Arc<Vec<SourceRootId>> { | 103 | fn local_roots() -> Arc<Vec<SourceRootId>> { |
97 | type LibrariesQuery; | 104 | type LocalRootsQuery; |
105 | storage input; | ||
106 | } | ||
107 | fn library_roots() -> Arc<Vec<SourceRootId>> { | ||
108 | type LibraryRootsQuery; | ||
98 | storage input; | 109 | storage input; |
99 | } | 110 | } |
100 | fn crate_graph() -> Arc<CrateGraph> { | 111 | fn crate_graph() -> Arc<CrateGraph> { |
@@ -104,13 +115,7 @@ salsa::query_group! { | |||
104 | } | 115 | } |
105 | } | 116 | } |
106 | 117 | ||
107 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
108 | pub struct SourceRootId(pub u32); | ||
109 | |||
110 | #[derive(Default, Clone, Debug, PartialEq, Eq)] | 118 | #[derive(Default, Clone, Debug, PartialEq, Eq)] |
111 | pub struct SourceRoot { | 119 | pub struct SourceRoot { |
112 | pub file_resolver: FileResolverImp, | 120 | pub files: FxHashMap<RelativePathBuf, FileId>, |
113 | pub files: FxHashSet<FileId>, | ||
114 | } | 121 | } |
115 | |||
116 | pub const WORKSPACE: SourceRootId = SourceRootId(0); | ||