diff options
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 1ef07d8f4..e579e2ee2 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -12,8 +12,8 @@ use ra_syntax::{ | |||
12 | use ra_text_edit::Indel; | 12 | use ra_text_edit::Indel; |
13 | 13 | ||
14 | use super::patterns::{ | 14 | use super::patterns::{ |
15 | goes_after_unsafe, has_bind_pat_parent, has_block_expr_parent, has_ref_pat_parent, | 15 | goes_after_unsafe, has_bind_pat_parent, has_block_expr_parent, has_impl_as_prev_sibling, |
16 | is_in_loop_body, | 16 | has_ref_pat_parent, has_trait_as_prev_sibling, inside_trait, is_in_loop_body, |
17 | }; | 17 | }; |
18 | use crate::{call_info::ActiveParameter, completion::CompletionConfig, FilePosition}; | 18 | use crate::{call_info::ActiveParameter, completion::CompletionConfig, FilePosition}; |
19 | use test_utils::mark; | 19 | use test_utils::mark; |
@@ -69,6 +69,9 @@ pub(crate) struct CompletionContext<'a> { | |||
69 | pub(super) bind_pat_parent: bool, | 69 | pub(super) bind_pat_parent: bool, |
70 | pub(super) ref_pat_parent: bool, | 70 | pub(super) ref_pat_parent: bool, |
71 | pub(super) in_loop_body: bool, | 71 | pub(super) in_loop_body: bool, |
72 | pub(super) inside_trait: bool, | ||
73 | pub(super) trait_as_prev_sibling: bool, | ||
74 | pub(super) impl_as_prev_sibling: bool, | ||
72 | } | 75 | } |
73 | 76 | ||
74 | impl<'a> CompletionContext<'a> { | 77 | impl<'a> CompletionContext<'a> { |
@@ -132,6 +135,9 @@ impl<'a> CompletionContext<'a> { | |||
132 | ref_pat_parent: false, | 135 | ref_pat_parent: false, |
133 | bind_pat_parent: false, | 136 | bind_pat_parent: false, |
134 | block_expr_parent: false, | 137 | block_expr_parent: false, |
138 | inside_trait: false, | ||
139 | trait_as_prev_sibling: false, | ||
140 | impl_as_prev_sibling: false, | ||
135 | }; | 141 | }; |
136 | 142 | ||
137 | let mut original_file = original_file.syntax().clone(); | 143 | let mut original_file = original_file.syntax().clone(); |
@@ -210,6 +216,9 @@ impl<'a> CompletionContext<'a> { | |||
210 | self.bind_pat_parent = has_bind_pat_parent(syntax_element.clone()); | 216 | self.bind_pat_parent = has_bind_pat_parent(syntax_element.clone()); |
211 | self.ref_pat_parent = has_ref_pat_parent(syntax_element.clone()); | 217 | self.ref_pat_parent = has_ref_pat_parent(syntax_element.clone()); |
212 | self.in_loop_body = is_in_loop_body(syntax_element.clone()); | 218 | self.in_loop_body = is_in_loop_body(syntax_element.clone()); |
219 | self.inside_trait = inside_trait(syntax_element.clone()); | ||
220 | self.impl_as_prev_sibling = has_impl_as_prev_sibling(syntax_element.clone()); | ||
221 | self.trait_as_prev_sibling = has_trait_as_prev_sibling(syntax_element.clone()); | ||
213 | } | 222 | } |
214 | 223 | ||
215 | fn fill( | 224 | fn fill( |