diff options
| author | lh123 <1585086582@qq.com> | 2025-01-16 14:47:26 +0800 |
|---|---|---|
| committer | lh123 <1585086582@qq.com> | 2025-01-16 14:47:26 +0800 |
| commit | b6ba392bb1dce09c789aa99297d0f6a5fdc04117 (patch) | |
| tree | e52c0d57135df6ba42bd67d957acf1be3171dc05 | |
| parent | 88ae0896f9e8bea458428c5edfd1068c27bcd2a2 (diff) | |
add go-to-type-def actions for func params
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/hover.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/hover.rs b/src/tools/rust-analyzer/crates/ide/src/hover.rs index 1431bd8ca29..6b461a62687 100644 --- a/src/tools/rust-analyzer/crates/ide/src/hover.rs +++ b/src/tools/rust-analyzer/crates/ide/src/hover.rs @@ -557,12 +557,16 @@ fn goto_type_action_for_def( .into_iter() .filter(|&it| Some(it.into()) != sized_trait) .for_each(|it| push_new_def(it.into())); + } else if let Definition::Function(function) = def { + walk_and_push_ty(db, &function.ret_type(db), &mut push_new_def); + for param in function.params_without_self(db) { + walk_and_push_ty(db, param.ty(), &mut push_new_def); + } } else { let ty = match def { Definition::Local(it) => it.ty(db), Definition::GenericParam(hir::GenericParam::ConstParam(it)) => it.ty(db), Definition::Field(field) => field.ty(db), - Definition::Function(function) => function.ret_type(db), _ => return HoverAction::goto_type_from_targets(db, targets, edition), }; |
