diff options
Diffstat (limited to 'crates/completion/src/context.rs')
-rw-r--r-- | crates/completion/src/context.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/completion/src/context.rs b/crates/completion/src/context.rs index ebf28e887..d809460e2 100644 --- a/crates/completion/src/context.rs +++ b/crates/completion/src/context.rs | |||
@@ -92,6 +92,7 @@ pub(crate) struct CompletionContext<'a> { | |||
92 | pub(super) has_item_list_or_source_file_parent: bool, | 92 | pub(super) has_item_list_or_source_file_parent: bool, |
93 | pub(super) for_is_prev2: bool, | 93 | pub(super) for_is_prev2: bool, |
94 | pub(super) fn_is_prev: bool, | 94 | pub(super) fn_is_prev: bool, |
95 | pub(super) incomplete_let: bool, | ||
95 | pub(super) locals: Vec<(String, Local)>, | 96 | pub(super) locals: Vec<(String, Local)>, |
96 | } | 97 | } |
97 | 98 | ||
@@ -132,9 +133,9 @@ impl<'a> CompletionContext<'a> { | |||
132 | scope, | 133 | scope, |
133 | db, | 134 | db, |
134 | config, | 135 | config, |
136 | position, | ||
135 | original_token, | 137 | original_token, |
136 | token, | 138 | token, |
137 | position, | ||
138 | krate, | 139 | krate, |
139 | expected_type: None, | 140 | expected_type: None, |
140 | name_ref_syntax: None, | 141 | name_ref_syntax: None, |
@@ -155,30 +156,31 @@ impl<'a> CompletionContext<'a> { | |||
155 | is_expr: false, | 156 | is_expr: false, |
156 | is_new_item: false, | 157 | is_new_item: false, |
157 | dot_receiver: None, | 158 | dot_receiver: None, |
159 | dot_receiver_is_ambiguous_float_literal: false, | ||
158 | is_call: false, | 160 | is_call: false, |
159 | is_pattern_call: false, | 161 | is_pattern_call: false, |
160 | is_macro_call: false, | 162 | is_macro_call: false, |
161 | is_path_type: false, | 163 | is_path_type: false, |
162 | has_type_args: false, | 164 | has_type_args: false, |
163 | dot_receiver_is_ambiguous_float_literal: false, | ||
164 | attribute_under_caret: None, | 165 | attribute_under_caret: None, |
165 | mod_declaration_under_caret: None, | 166 | mod_declaration_under_caret: None, |
166 | unsafe_is_prev: false, | 167 | unsafe_is_prev: false, |
167 | in_loop_body: false, | 168 | if_is_prev: false, |
168 | ref_pat_parent: false, | ||
169 | bind_pat_parent: false, | ||
170 | block_expr_parent: false, | 169 | block_expr_parent: false, |
170 | bind_pat_parent: false, | ||
171 | ref_pat_parent: false, | ||
172 | in_loop_body: false, | ||
171 | has_trait_parent: false, | 173 | has_trait_parent: false, |
172 | has_impl_parent: false, | 174 | has_impl_parent: false, |
173 | inside_impl_trait_block: false, | 175 | inside_impl_trait_block: false, |
174 | has_field_list_parent: false, | 176 | has_field_list_parent: false, |
175 | trait_as_prev_sibling: false, | 177 | trait_as_prev_sibling: false, |
176 | impl_as_prev_sibling: false, | 178 | impl_as_prev_sibling: false, |
177 | if_is_prev: false, | ||
178 | is_match_arm: false, | 179 | is_match_arm: false, |
179 | has_item_list_or_source_file_parent: false, | 180 | has_item_list_or_source_file_parent: false, |
180 | for_is_prev2: false, | 181 | for_is_prev2: false, |
181 | fn_is_prev: false, | 182 | fn_is_prev: false, |
183 | incomplete_let: false, | ||
182 | locals, | 184 | locals, |
183 | }; | 185 | }; |
184 | 186 | ||
@@ -270,6 +272,10 @@ impl<'a> CompletionContext<'a> { | |||
270 | .filter(|module| module.item_list().is_none()); | 272 | .filter(|module| module.item_list().is_none()); |
271 | self.for_is_prev2 = for_is_prev2(syntax_element.clone()); | 273 | self.for_is_prev2 = for_is_prev2(syntax_element.clone()); |
272 | self.fn_is_prev = fn_is_prev(syntax_element.clone()); | 274 | self.fn_is_prev = fn_is_prev(syntax_element.clone()); |
275 | self.incomplete_let = | ||
276 | syntax_element.ancestors().take(6).find_map(ast::LetStmt::cast).map_or(false, |it| { | ||
277 | it.syntax().text_range().end() == syntax_element.text_range().end() | ||
278 | }); | ||
273 | } | 279 | } |
274 | 280 | ||
275 | fn fill( | 281 | fn fill( |