aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-09-04 13:13:31 +0100
committerKirill Bulatov <[email protected]>2020-09-09 23:42:20 +0100
commit486c5c3285682408b125613475a34a0bc9a2c097 (patch)
tree8928b836c589c783ad1f426218a134292926cffe /crates/base_db
parent897a4c702e3d6fa9156ea0bc34af9d397fae3440 (diff)
Exclude special files
Diffstat (limited to 'crates/base_db')
-rw-r--r--crates/base_db/src/lib.rs5
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 }