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 47355d5dc..161f59c1e 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, |
@@ -152,6 +153,7 @@ impl<'a> CompletionContext<'a> { | |||
152 | has_type_args: false, | 153 | has_type_args: false, |
153 | dot_receiver_is_ambiguous_float_literal: false, | 154 | dot_receiver_is_ambiguous_float_literal: false, |
154 | attribute_under_caret: None, | 155 | attribute_under_caret: None, |
156 | mod_declaration_under_caret: None, | ||
155 | unsafe_is_prev: false, | 157 | unsafe_is_prev: false, |
156 | in_loop_body: false, | 158 | in_loop_body: false, |
157 | ref_pat_parent: false, | 159 | ref_pat_parent: false, |
@@ -238,7 +240,10 @@ impl<'a> CompletionContext<'a> { | |||
238 | self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); | 240 | self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); |
239 | self.is_match_arm = is_match_arm(syntax_element.clone()); | 241 | self.is_match_arm = is_match_arm(syntax_element.clone()); |
240 | self.has_item_list_or_source_file_parent = | 242 | self.has_item_list_or_source_file_parent = |
241 | has_item_list_or_source_file_parent(syntax_element); | 243 | has_item_list_or_source_file_parent(syntax_element.clone()); |
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()); | ||
242 | } | 247 | } |
243 | 248 | ||
244 | fn fill( | 249 | fn fill( |