diff options
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/lib.rs | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index c72e254f4..030b96829 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs | |||
@@ -167,29 +167,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> { | |||
167 | } | 167 | } |
168 | 168 | ||
169 | fn possible_sudmobule_names(&self, module_file: FileId) -> Vec<String> { | 169 | fn possible_sudmobule_names(&self, module_file: FileId) -> Vec<String> { |
170 | let module_files = &self.source_root(module_file).file_set; | 170 | self.source_root(module_file).file_set.possible_sudmobule_names(module_file) |
171 | let possible_submodule_files = match module_files.file_name_and_extension(module_file) { | ||
172 | Some(("mod", Some("rs"))) | Some(("lib", Some("rs"))) => { | ||
173 | module_files.list_files_with_extensions(module_file, None) | ||
174 | } | ||
175 | // TODO kb for `src/bin/foo.rs`, we need to check for modules in `src/bin/` | ||
176 | Some((directory_with_module_name, Some("rs"))) => module_files | ||
177 | .list_files_with_extensions( | ||
178 | module_file, | ||
179 | Some(&format!("../{}/", directory_with_module_name)), | ||
180 | ), | ||
181 | // TODO kb also consider the case when there's no `../module_name.rs`, but `../module_name/mod.rs` | ||
182 | _ => Vec::new(), | ||
183 | }; | ||
184 | |||
185 | possible_submodule_files | ||
186 | .into_iter() | ||
187 | .filter(|(_, extension)| extension == &Some("rs")) | ||
188 | .filter(|(file_name, _)| file_name != &"mod") | ||
189 | .filter(|(file_name, _)| file_name != &"lib") | ||
190 | .filter(|(file_name, _)| file_name != &"main") | ||
191 | .map(|(file_name, _)| file_name.to_owned()) | ||
192 | .collect() | ||
193 | } | 171 | } |
194 | } | 172 | } |
195 | 173 | ||