From 486c5c3285682408b125613475a34a0bc9a2c097 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Fri, 4 Sep 2020 15:13:31 +0300 Subject: Exclude special files --- crates/base_db/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/base_db') 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 FileLoader for FileLoaderDelegate<&'_ T> { Some(("mod", Some("rs"))) | Some(("lib", Some("rs"))) => { module_files.list_files_with_extensions(module_file, None) } + // TODO kb for `src/bin/foo.rs`, we need to check for modules in `src/bin/` Some((directory_with_module_name, Some("rs"))) => module_files .list_files_with_extensions( module_file, Some(&format!("../{}/", directory_with_module_name)), ), + // TODO kb also consider the case when there's no `../module_name.rs`, but `../module_name/mod.rs` _ => Vec::new(), }; possible_submodule_files .into_iter() .filter(|(_, extension)| extension == &Some("rs")) + .filter(|(file_name, _)| file_name != &"mod") + .filter(|(file_name, _)| file_name != &"lib") + .filter(|(file_name, _)| file_name != &"main") .map(|(file_name, _)| file_name.to_owned()) .collect() } -- cgit v1.2.3