mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 05:08:52 +00:00
Exclude special files
This commit is contained in:
parent
897a4c702e
commit
486c5c3285
2 changed files with 5 additions and 3 deletions
|
@ -172,17 +172,22 @@ impl<T: SourceDatabaseExt> 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()
|
||||
}
|
||||
|
|
|
@ -117,9 +117,6 @@ impl<'a> CompletionContext<'a> {
|
|||
.to_module_def(position.file_id)
|
||||
.and_then(|current_module| {
|
||||
let definition_source = current_module.definition_source(db);
|
||||
if !matches!(definition_source.value, ModuleSource::SourceFile(_)) {
|
||||
return None;
|
||||
}
|
||||
let module_definition_source_file = definition_source.file_id.original_file(db);
|
||||
let mod_declaration_candidates =
|
||||
db.possible_sudmobule_names(module_definition_source_file);
|
||||
|
|
Loading…
Reference in a new issue