aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/context.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-21 00:10:59 +0000
committerLukas Wirth <[email protected]>2021-03-21 00:28:42 +0000
commit64957acb5f359763395a54e314d1f5d5cfc6ccf3 (patch)
tree00cec518c2cfd88dac252a4aad824372c7afc898 /crates/ide_completion/src/context.rs
parent62a4677dbc6cf1c90e4558c3c73fef201a0d1080 (diff)
Fix incorrect scoping in while expressions
Diffstat (limited to 'crates/ide_completion/src/context.rs')
-rw-r--r--crates/ide_completion/src/context.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index 6cb7e5264..67e2d6f6c 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -475,19 +475,17 @@ impl<'a> CompletionContext<'a> {
475 return; 475 return;
476 } 476 }
477 477
478 if parent.kind() != syntax::SyntaxKind::LABEL { 478 match_ast! {
479 match_ast! { 479 match parent {
480 match parent { 480 ast::LifetimeParam(_it) => {
481 ast::LifetimeParam(_it) => { 481 self.lifetime_allowed = true;
482 self.lifetime_allowed = true; 482 self.lifetime_param_syntax =
483 self.lifetime_param_syntax = 483 self.sema.find_node_at_offset_with_macros(original_file, offset);
484 self.sema.find_node_at_offset_with_macros(original_file, offset); 484 },
485 }, 485 ast::BreakExpr(_it) => self.is_label_ref = true,
486 ast::BreakExpr(_it) => self.is_label_ref = true, 486 ast::ContinueExpr(_it) => self.is_label_ref = true,
487 ast::ContinueExpr(_it) => self.is_label_ref = true, 487 ast::Label(_it) => (),
488 ast::Label(_it) => (), 488 _ => self.lifetime_allowed = true,
489 _ => self.lifetime_allowed = true,
490 }
491 } 489 }
492 } 490 }
493 } 491 }