From 3a10f87471eed9d8fbc68f263e363ba22d3f8f82 Mon Sep 17 00:00:00 2001 From: Aria Desires Date: Wed, 12 Nov 2025 23:23:29 -0500 Subject: [PATCH] only apply the rule if non-trivial --- crates/ty_ide/src/goto.rs | 9 ++++--- crates/ty_ide/src/hover.rs | 52 ++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/crates/ty_ide/src/goto.rs b/crates/ty_ide/src/goto.rs index d4649ca31d..94d22fccff 100644 --- a/crates/ty_ide/src/goto.rs +++ b/crates/ty_ide/src/goto.rs @@ -332,9 +332,12 @@ impl GotoTarget<'_> { model: &SemanticModel<'db>, ) -> Option>> { if let GotoTarget::Call { call, .. } = self { - let signature_details = call_signature_details_typed(model.db(), model, call); - if !signature_details.is_empty() { - return Some(signature_details); + let signature_details = call_signature_details(model.db(), model, call); + if signature_details.len() > 1 { + let signature_details = call_signature_details_typed(model.db(), model, call); + if !signature_details.is_empty() { + return Some(signature_details); + } } } None diff --git a/crates/ty_ide/src/hover.rs b/crates/ty_ide/src/hover.rs index c2a6ff9f75..cf9a66bf28 100644 --- a/crates/ty_ide/src/hover.rs +++ b/crates/ty_ide/src/hover.rs @@ -233,9 +233,10 @@ mod tests { ); assert_snapshot!(test.hover(), @r" - (a, b) -> Unknown - --------------------------------------------- - + def my_func( + a, + b + ) -> Unknown --------------------------------------------- This is such a great func!! @@ -245,10 +246,11 @@ mod tests { --------------------------------------------- ```python - (a, b) -> Unknown + def my_func( + a, + b + ) -> Unknown ``` - --- - --- ```text This is such a great func!! @@ -493,18 +495,14 @@ mod tests { ); assert_snapshot!(test.hover(), @r" - (val) -> MyClass - --------------------------------------------- - + --------------------------------------------- initializes MyClass (perfectly) --------------------------------------------- ```python - (val) -> MyClass + ``` - --- - --- ```text initializes MyClass (perfectly) @@ -556,18 +554,14 @@ mod tests { .build(); assert_snapshot!(test.hover(), @r" - (val) -> MyClass - --------------------------------------------- - + --------------------------------------------- initializes MyClass (perfectly) --------------------------------------------- ```python - (val) -> MyClass + ``` - --- - --- ```text initializes MyClass (perfectly) @@ -618,9 +612,7 @@ mod tests { ); assert_snapshot!(test.hover(), @r" - (val) -> MyClass - --------------------------------------------- - + --------------------------------------------- This is such a great class!! @@ -630,10 +622,8 @@ mod tests { --------------------------------------------- ```python - (val) -> MyClass + ``` - --- - --- ```text This is such a great class!! @@ -690,9 +680,10 @@ mod tests { ); assert_snapshot!(test.hover(), @r" - (a, b) -> Unknown - --------------------------------------------- - + bound method MyClass.my_method( + a, + b + ) -> Unknown --------------------------------------------- This is such a great func!! @@ -702,10 +693,11 @@ mod tests { --------------------------------------------- ```python - (a, b) -> Unknown + bound method MyClass.my_method( + a, + b + ) -> Unknown ``` - --- - --- ```text This is such a great func!!