Unnamed repository; edit this file 'description' to name the repository.
fix: navigate to label directly when perform 'goto-def' on control-flow kw
See https://github.com/rust-lang/rust-analyzer/pull/17542#discussion_r1667656190
| -rw-r--r-- | crates/ide/src/goto_definition.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 1f9ee2a317..0a4fbc874a 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -351,8 +351,8 @@ fn try_find_loop( if blk.label().is_some() && label_matches(blk.label()) => { let expr = ast::Expr::BlockExpr(blk.clone()); - let lbl_tok = blk.label().unwrap().lifetime()?.lifetime_ident_token()?.into(); - let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl_tok); + let lbl = blk.label().unwrap().syntax().clone().into(); + let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl); return Some(nav); } _ => {} @@ -2618,7 +2618,7 @@ fn main() { r#" fn main() { 'a:{ - // ^^ + // ^^^ break$0 'a; } } |