@@ -77,7 +77,7 @@ pub(crate) struct CompletionContext<'a> {
7777 pub ( super ) is_path_type : bool ,
7878 pub ( super ) has_type_args : bool ,
7979 pub ( super ) attribute_under_caret : Option < ast:: Attr > ,
80- pub ( super ) mod_under_caret : Option < ast:: Module > ,
80+ pub ( super ) mod_declaration_under_caret : Option < ast:: Module > ,
8181 pub ( super ) unsafe_is_prev : bool ,
8282 pub ( super ) if_is_prev : bool ,
8383 pub ( super ) block_expr_parent : bool ,
@@ -153,7 +153,7 @@ impl<'a> CompletionContext<'a> {
153153 has_type_args : false ,
154154 dot_receiver_is_ambiguous_float_literal : false ,
155155 attribute_under_caret : None ,
156- mod_under_caret : None ,
156+ mod_declaration_under_caret : None ,
157157 unsafe_is_prev : false ,
158158 in_loop_body : false ,
159159 ref_pat_parent : false ,
@@ -241,7 +241,9 @@ impl<'a> CompletionContext<'a> {
241241 self . is_match_arm = is_match_arm ( syntax_element. clone ( ) ) ;
242242 self . has_item_list_or_source_file_parent =
243243 has_item_list_or_source_file_parent ( syntax_element. clone ( ) ) ;
244- self . mod_under_caret = find_node_at_offset ( & file_with_fake_ident, offset) ;
244+ self . mod_declaration_under_caret =
245+ find_node_at_offset :: < ast:: Module > ( & file_with_fake_ident, offset)
246+ . filter ( |module| module. item_list ( ) . is_none ( ) ) ;
245247 }
246248
247249 fn fill (
0 commit comments