Skip to content

Commit 03404b7

Browse files
[ty] Show constructor signature on hover (#24257)
Co-authored-by: Micha Reiser <micha@reiser.io>
1 parent 86045e2 commit 03404b7

4 files changed

Lines changed: 657 additions & 65 deletions

File tree

crates/ty_ide/src/goto.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ty_python_semantic::ResolvedDefinition;
1616
use ty_python_semantic::semantic_index::definition::DefinitionKind;
1717
use ty_python_semantic::types::Type;
1818
use ty_python_semantic::types::ide_support::{
19-
call_signature_details, call_type_simplified_by_overloads,
19+
call_signature_details, call_type_simplified_by_overloads, constructor_signature,
2020
definitions_and_overloads_for_function, definitions_for_keyword_argument,
2121
typed_dict_key_definition,
2222
};
@@ -413,13 +413,11 @@ impl GotoTarget<'_> {
413413
}
414414
}
415415

416-
/// Try to get a simplified display of this callable type by resolving overloads
417-
pub(crate) fn call_type_simplified_by_overloads(
418-
&self,
419-
model: &SemanticModel,
420-
) -> Option<String> {
416+
/// Try to get a call signature for this target.
417+
pub(crate) fn call_signature(&self, model: &SemanticModel) -> Option<String> {
421418
if let GotoTarget::Call { call, .. } = self {
422-
call_type_simplified_by_overloads(model, call)
419+
constructor_signature(model, call)
420+
.or_else(|| call_type_simplified_by_overloads(model, call))
423421
} else {
424422
None
425423
}

0 commit comments

Comments
 (0)