diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 19:12:38 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 19:12:38 +0100 |
commit | 38ab326aac70484cb951fe9389d788d525d41550 (patch) | |
tree | 0032223efeefca76340fb0a97f6f12d0e432a2a9 /crates/ra_ide/src/completion/completion_context.rs | |
parent | 5cade89d730b025082ff2df70aace259951a9ccf (diff) | |
parent | 98181087984157e27faba0b969e384f3c62c39d5 (diff) |
Merge #5631
5631: Finalize pattern grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 2a5f3c3d2..6b03b30bb 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -265,7 +265,7 @@ impl<'a> CompletionContext<'a> { | |||
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | // FIXME: remove this (V) duplication and make the check more precise | 267 | // FIXME: remove this (V) duplication and make the check more precise |
268 | if name_ref.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { | 268 | if name_ref.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() { |
269 | self.record_pat_syntax = | 269 | self.record_pat_syntax = |
270 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 270 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
271 | } | 271 | } |
@@ -275,7 +275,7 @@ impl<'a> CompletionContext<'a> { | |||
275 | // Otherwise, see if this is a declaration. We can use heuristics to | 275 | // Otherwise, see if this is a declaration. We can use heuristics to |
276 | // suggest declaration names, see `CompletionKind::Magic`. | 276 | // suggest declaration names, see `CompletionKind::Magic`. |
277 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { | 277 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { |
278 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { | 278 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::IdentPat::cast) { |
279 | self.is_pat_binding_or_const = true; | 279 | self.is_pat_binding_or_const = true; |
280 | if bind_pat.at_token().is_some() | 280 | if bind_pat.at_token().is_some() |
281 | || bind_pat.ref_token().is_some() | 281 | || bind_pat.ref_token().is_some() |
@@ -283,7 +283,7 @@ impl<'a> CompletionContext<'a> { | |||
283 | { | 283 | { |
284 | self.is_pat_binding_or_const = false; | 284 | self.is_pat_binding_or_const = false; |
285 | } | 285 | } |
286 | if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { | 286 | if bind_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast).is_some() { |
287 | self.is_pat_binding_or_const = false; | 287 | self.is_pat_binding_or_const = false; |
288 | } | 288 | } |
289 | if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { | 289 | if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { |
@@ -300,7 +300,7 @@ impl<'a> CompletionContext<'a> { | |||
300 | return; | 300 | return; |
301 | } | 301 | } |
302 | // FIXME: remove this (^) duplication and make the check more precise | 302 | // FIXME: remove this (^) duplication and make the check more precise |
303 | if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { | 303 | if name.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() { |
304 | self.record_pat_syntax = | 304 | self.record_pat_syntax = |
305 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 305 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
306 | } | 306 | } |