diff options
author | Kirill Bulatov <[email protected]> | 2020-09-03 23:32:06 +0100 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-09-09 23:42:20 +0100 |
commit | 0de71f7bc9482c9d1ef7e9d36ec5d6c5fd378781 (patch) | |
tree | 476d805b91fde4be5801c50dbb696b49eb92abbc /crates/base_db | |
parent | 17870a3e2c39770a99f9ab5ce090abbe1dc334d2 (diff) |
Properly use FileSet API
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/lib.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index 37a8432bd..1bc4690c9 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs | |||
@@ -171,16 +171,14 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> { | |||
171 | module_files: &FileSet, | 171 | module_files: &FileSet, |
172 | module_file: FileId, | 172 | module_file: FileId, |
173 | ) -> Option<Vec<(FileId, String)>> { | 173 | ) -> Option<Vec<(FileId, String)>> { |
174 | // TODO kb resolve path thinks that the input is a file... | 174 | match module_files.file_name_and_extension(module_file)? { |
175 | let directory_with_module_file = module_files.resolve_path(module_file, "/../")?; | 175 | ("mod", Some("rs")) | ("lib", Some("rs")) => { |
176 | let directory_with_applicable_modules = | 176 | module_files.list_files(module_file, None) |
177 | match module_files.file_name_and_extension(module_file)? { | 177 | } |
178 | ("mod", "rs") | ("lib", "rs") => Some(directory_with_module_file), | 178 | (directory_with_module_name, Some("rs")) => module_files |
179 | (directory_with_module_name, "rs") => module_files | 179 | .list_files(module_file, Some(&format!("../{}/", directory_with_module_name))), |
180 | .resolve_path(directory_with_module_file, directory_with_module_name), | 180 | _ => None, |
181 | _ => None, | 181 | } |
182 | }?; | ||
183 | Some(module_files.list_files(directory_with_applicable_modules)) | ||
184 | } | 182 | } |
185 | 183 | ||
186 | possible_sudmobules_opt(&self.source_root(module_file).file_set, module_file) | 184 | possible_sudmobules_opt(&self.source_root(module_file).file_set, module_file) |