mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
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
This commit is contained in:
parent
07570bac66
commit
22c5924080
1 changed files with 3 additions and 3 deletions
|
@ -351,8 +351,8 @@ fn try_find_loop(
|
||||||
if blk.label().is_some() && label_matches(blk.label()) =>
|
if blk.label().is_some() && label_matches(blk.label()) =>
|
||||||
{
|
{
|
||||||
let expr = ast::Expr::BlockExpr(blk.clone());
|
let expr = ast::Expr::BlockExpr(blk.clone());
|
||||||
let lbl_tok = blk.label().unwrap().lifetime()?.lifetime_ident_token()?.into();
|
let lbl = blk.label().unwrap().syntax().clone().into();
|
||||||
let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl_tok);
|
let nav = NavigationTarget::from_expr(db, InFile::new(file_id, expr), lbl);
|
||||||
return Some(nav);
|
return Some(nav);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -2618,7 +2618,7 @@ fn main() {
|
||||||
r#"
|
r#"
|
||||||
fn main() {
|
fn main() {
|
||||||
'a:{
|
'a:{
|
||||||
// ^^
|
// ^^^
|
||||||
break$0 'a;
|
break$0 'a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue