diff options
Diffstat (limited to 'crates/ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ide/src/completion/completion_context.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide/src/completion/completion_context.rs b/crates/ide/src/completion/completion_context.rs index 3ef1b97cf..671b13328 100644 --- a/crates/ide/src/completion/completion_context.rs +++ b/crates/ide/src/completion/completion_context.rs | |||
@@ -77,6 +77,7 @@ pub(crate) struct CompletionContext<'a> { | |||
77 | pub(super) is_path_type: bool, | 77 | pub(super) is_path_type: bool, |
78 | pub(super) has_type_args: bool, | 78 | pub(super) has_type_args: bool, |
79 | pub(super) attribute_under_caret: Option<ast::Attr>, | 79 | pub(super) attribute_under_caret: Option<ast::Attr>, |
80 | pub(super) mod_declaration_under_caret: Option<ast::Module>, | ||
80 | pub(super) unsafe_is_prev: bool, | 81 | pub(super) unsafe_is_prev: bool, |
81 | pub(super) if_is_prev: bool, | 82 | pub(super) if_is_prev: bool, |
82 | pub(super) block_expr_parent: bool, | 83 | pub(super) block_expr_parent: bool, |
@@ -159,6 +160,7 @@ impl<'a> CompletionContext<'a> { | |||
159 | has_type_args: false, | 160 | has_type_args: false, |
160 | dot_receiver_is_ambiguous_float_literal: false, | 161 | dot_receiver_is_ambiguous_float_literal: false, |
161 | attribute_under_caret: None, | 162 | attribute_under_caret: None, |
163 | mod_declaration_under_caret: None, | ||
162 | unsafe_is_prev: false, | 164 | unsafe_is_prev: false, |
163 | in_loop_body: false, | 165 | in_loop_body: false, |
164 | ref_pat_parent: false, | 166 | ref_pat_parent: false, |
@@ -246,7 +248,10 @@ impl<'a> CompletionContext<'a> { | |||
246 | self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); | 248 | self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); |
247 | self.is_match_arm = is_match_arm(syntax_element.clone()); | 249 | self.is_match_arm = is_match_arm(syntax_element.clone()); |
248 | self.has_item_list_or_source_file_parent = | 250 | self.has_item_list_or_source_file_parent = |
249 | has_item_list_or_source_file_parent(syntax_element); | 251 | has_item_list_or_source_file_parent(syntax_element.clone()); |
252 | self.mod_declaration_under_caret = | ||
253 | find_node_at_offset::<ast::Module>(&file_with_fake_ident, offset) | ||
254 | .filter(|module| module.item_list().is_none()); | ||
250 | } | 255 | } |
251 | 256 | ||
252 | fn fill( | 257 | fn fill( |