diff options
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index 55ef9fc24..c72e254f4 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs | |||
@@ -172,17 +172,22 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> { | |||
172 | Some(("mod", Some("rs"))) | Some(("lib", Some("rs"))) => { | 172 | Some(("mod", Some("rs"))) | Some(("lib", Some("rs"))) => { |
173 | module_files.list_files_with_extensions(module_file, None) | 173 | module_files.list_files_with_extensions(module_file, None) |
174 | } | 174 | } |
175 | // TODO kb for `src/bin/foo.rs`, we need to check for modules in `src/bin/` | ||
175 | Some((directory_with_module_name, Some("rs"))) => module_files | 176 | Some((directory_with_module_name, Some("rs"))) => module_files |
176 | .list_files_with_extensions( | 177 | .list_files_with_extensions( |
177 | module_file, | 178 | module_file, |
178 | Some(&format!("../{}/", directory_with_module_name)), | 179 | Some(&format!("../{}/", directory_with_module_name)), |
179 | ), | 180 | ), |
181 | // TODO kb also consider the case when there's no `../module_name.rs`, but `../module_name/mod.rs` | ||
180 | _ => Vec::new(), | 182 | _ => Vec::new(), |
181 | }; | 183 | }; |
182 | 184 | ||
183 | possible_submodule_files | 185 | possible_submodule_files |
184 | .into_iter() | 186 | .into_iter() |
185 | .filter(|(_, extension)| extension == &Some("rs")) | 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") | ||
186 | .map(|(file_name, _)| file_name.to_owned()) | 191 | .map(|(file_name, _)| file_name.to_owned()) |
187 | .collect() | 192 | .collect() |
188 | } | 193 | } |