Skip to content

Commit b6ba392

Browse files
committed
add go-to-type-def actions for func params
1 parent 88ae089 commit b6ba392

File tree

1 file changed

+5
-1
lines changed
  • src/tools/rust-analyzer/crates/ide/src

1 file changed

+5
-1
lines changed

src/tools/rust-analyzer/crates/ide/src/hover.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,16 @@ fn goto_type_action_for_def(
557557
.into_iter()
558558
.filter(|&it| Some(it.into()) != sized_trait)
559559
.for_each(|it| push_new_def(it.into()));
560+
} else if let Definition::Function(function) = def {
561+
walk_and_push_ty(db, &function.ret_type(db), &mut push_new_def);
562+
for param in function.params_without_self(db) {
563+
walk_and_push_ty(db, param.ty(), &mut push_new_def);
564+
}
560565
} else {
561566
let ty = match def {
562567
Definition::Local(it) => it.ty(db),
563568
Definition::GenericParam(hir::GenericParam::ConstParam(it)) => it.ty(db),
564569
Definition::Field(field) => field.ty(db),
565-
Definition::Function(function) => function.ret_type(db),
566570
_ => return HoverAction::goto_type_from_targets(db, targets, edition),
567571
};
568572

0 commit comments

Comments
 (0)