File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -172,17 +172,22 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
172
172
Some ( ( "mod" , Some ( "rs" ) ) ) | Some ( ( "lib" , Some ( "rs" ) ) ) => {
173
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
176
Some ( ( directory_with_module_name, Some ( "rs" ) ) ) => module_files
176
177
. list_files_with_extensions (
177
178
module_file,
178
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
182
_ => Vec :: new ( ) ,
181
183
} ;
182
184
183
185
possible_submodule_files
184
186
. into_iter ( )
185
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
191
. map ( |( file_name, _) | file_name. to_owned ( ) )
187
192
. collect ( )
188
193
}
Original file line number Diff line number Diff line change @@ -117,9 +117,6 @@ impl<'a> CompletionContext<'a> {
117
117
. to_module_def ( position. file_id )
118
118
. and_then ( |current_module| {
119
119
let definition_source = current_module. definition_source ( db) ;
120
- if !matches ! ( definition_source. value, ModuleSource :: SourceFile ( _) ) {
121
- return None ;
122
- }
123
120
let module_definition_source_file = definition_source. file_id . original_file ( db) ;
124
121
let mod_declaration_candidates =
125
122
db. possible_sudmobule_names ( module_definition_source_file) ;
You can’t perform that action at this time.
0 commit comments