aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db/src
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-08-28 19:28:30 +0100
committerKirill Bulatov <[email protected]>2020-09-09 23:42:20 +0100
commit4bed588001a1d6cd5c83a3eefc6ef77c439de40b (patch)
tree92552f2af9a6aefcd4fffc20d7cbd06d1bc74d3c /crates/base_db/src
parent5c336e266fe09ae9ae6e634513d441cbcde63696 (diff)
First steps for mod<|> completion
Diffstat (limited to 'crates/base_db/src')
-rw-r--r--crates/base_db/src/lib.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs
index ee3415850..71e85c6ac 100644
--- a/crates/base_db/src/lib.rs
+++ b/crates/base_db/src/lib.rs
@@ -96,6 +96,7 @@ pub trait FileLoader {
96 /// `#[path = "C://no/way"]` 96 /// `#[path = "C://no/way"]`
97 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId>; 97 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId>;
98 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>>; 98 fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>>;
99 fn list_some_random_files_todo(&self, anchor: FileId) -> Vec<(FileId, String)>;
99} 100}
100 101
101/// Database which stores all significant input facts: source code and project 102/// Database which stores all significant input facts: source code and project
@@ -155,8 +156,8 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
155 } 156 }
156 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { 157 fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> {
157 // FIXME: this *somehow* should be platform agnostic... 158 // FIXME: this *somehow* should be platform agnostic...
158 let source_root = self.0.file_source_root(anchor); 159 // self.source_root(anchor)
159 let source_root = self.0.source_root(source_root); 160 let source_root = self.source_root(anchor);
160 source_root.file_set.resolve_path(anchor, path) 161 source_root.file_set.resolve_path(anchor, path)
161 } 162 }
162 163
@@ -164,4 +165,15 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
164 let source_root = self.0.file_source_root(file_id); 165 let source_root = self.0.file_source_root(file_id);
165 self.0.source_root_crates(source_root) 166 self.0.source_root_crates(source_root)
166 } 167 }
168
169 fn list_some_random_files_todo(&self, anchor: FileId) -> Vec<(FileId, String)> {
170 self.source_root(anchor).file_set.list_some_random_files_todo(anchor)
171 }
172}
173
174impl<T: SourceDatabaseExt> FileLoaderDelegate<&'_ T> {
175 fn source_root(&self, anchor: FileId) -> Arc<SourceRoot> {
176 let source_root = self.0.file_source_root(anchor);
177 self.0.source_root(source_root)
178 }
167} 179}