diff options
5 files changed, 9 insertions, 7 deletions
diff --git a/crates/ide/src/completion/complete_attribute.rs b/crates/ide/src/completion/complete_attribute.rs index ef4fb6a91..f4a9864d1 100644 --- a/crates/ide/src/completion/complete_attribute.rs +++ b/crates/ide/src/completion/complete_attribute.rs | |||
@@ -13,7 +13,7 @@ use crate::completion::{ | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 15 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
16 | if ctx.mod_under_caret.is_some() { | 16 | if ctx.mod_declaration_under_caret.is_some() { |
17 | return None; | 17 | return None; |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/crates/ide/src/completion/complete_mod.rs b/crates/ide/src/completion/complete_mod.rs index 049e99674..d457ff6bf 100644 --- a/crates/ide/src/completion/complete_mod.rs +++ b/crates/ide/src/completion/complete_mod.rs | |||
@@ -14,7 +14,7 @@ use super::{ | |||
14 | 14 | ||
15 | /// Complete mod declaration, i.e. `mod <|> ;` | 15 | /// Complete mod declaration, i.e. `mod <|> ;` |
16 | pub(super) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 16 | pub(super) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
17 | let mod_under_caret = match &ctx.mod_under_caret { | 17 | let mod_under_caret = match &ctx.mod_declaration_under_caret { |
18 | Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None, | 18 | Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None, |
19 | Some(mod_under_caret) => mod_under_caret, | 19 | Some(mod_under_caret) => mod_under_caret, |
20 | None => return None, | 20 | None => return None, |
diff --git a/crates/ide/src/completion/complete_qualified_path.rs b/crates/ide/src/completion/complete_qualified_path.rs index 184488a73..79de50792 100644 --- a/crates/ide/src/completion/complete_qualified_path.rs +++ b/crates/ide/src/completion/complete_qualified_path.rs | |||
@@ -13,7 +13,7 @@ pub(super) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
13 | None => return, | 13 | None => return, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | if ctx.attribute_under_caret.is_some() || ctx.mod_under_caret.is_some() { | 16 | if ctx.attribute_under_caret.is_some() || ctx.mod_declaration_under_caret.is_some() { |
17 | return; | 17 | return; |
18 | } | 18 | } |
19 | 19 | ||
diff --git a/crates/ide/src/completion/complete_unqualified_path.rs b/crates/ide/src/completion/complete_unqualified_path.rs index f2189dfde..8eda4b64d 100644 --- a/crates/ide/src/completion/complete_unqualified_path.rs +++ b/crates/ide/src/completion/complete_unqualified_path.rs | |||
@@ -13,7 +13,7 @@ pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC | |||
13 | if ctx.record_lit_syntax.is_some() | 13 | if ctx.record_lit_syntax.is_some() |
14 | || ctx.record_pat_syntax.is_some() | 14 | || ctx.record_pat_syntax.is_some() |
15 | || ctx.attribute_under_caret.is_some() | 15 | || ctx.attribute_under_caret.is_some() |
16 | || ctx.mod_under_caret.is_some() | 16 | || ctx.mod_declaration_under_caret.is_some() |
17 | { | 17 | { |
18 | return; | 18 | return; |
19 | } | 19 | } |
diff --git a/crates/ide/src/completion/completion_context.rs b/crates/ide/src/completion/completion_context.rs index ea4830843..161f59c1e 100644 --- a/crates/ide/src/completion/completion_context.rs +++ b/crates/ide/src/completion/completion_context.rs | |||
@@ -77,7 +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_under_caret: Option<ast::Module>, | 80 | pub(super) mod_declaration_under_caret: Option<ast::Module>, |
81 | pub(super) unsafe_is_prev: bool, | 81 | pub(super) unsafe_is_prev: bool, |
82 | pub(super) if_is_prev: bool, | 82 | pub(super) if_is_prev: bool, |
83 | pub(super) block_expr_parent: bool, | 83 | pub(super) block_expr_parent: bool, |
@@ -153,7 +153,7 @@ impl<'a> CompletionContext<'a> { | |||
153 | has_type_args: false, | 153 | has_type_args: false, |
154 | dot_receiver_is_ambiguous_float_literal: false, | 154 | dot_receiver_is_ambiguous_float_literal: false, |
155 | attribute_under_caret: None, | 155 | attribute_under_caret: None, |
156 | mod_under_caret: None, | 156 | mod_declaration_under_caret: None, |
157 | unsafe_is_prev: false, | 157 | unsafe_is_prev: false, |
158 | in_loop_body: false, | 158 | in_loop_body: false, |
159 | ref_pat_parent: false, | 159 | ref_pat_parent: false, |
@@ -241,7 +241,9 @@ impl<'a> CompletionContext<'a> { | |||
241 | self.is_match_arm = is_match_arm(syntax_element.clone()); | 241 | self.is_match_arm = is_match_arm(syntax_element.clone()); |
242 | self.has_item_list_or_source_file_parent = | 242 | self.has_item_list_or_source_file_parent = |
243 | has_item_list_or_source_file_parent(syntax_element.clone()); | 243 | 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()); | ||
245 | } | 247 | } |
246 | 248 | ||
247 | fn fill( | 249 | fn fill( |