Skip to content

Commit a8bc625

Browse files
committed
Auto merge of rust-lang#12082 - iDawer:ide.signature_help, r=lnicola
fix: `signature_help`: use corresponding param list for methods Close rust-lang#12079
2 parents 1b12021 + 729cd85 commit a8bc625

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

crates/ide/src/signature_help.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ fn signature_help_for_call(
115115
hir::CallableKind::Function(func) => {
116116
res.doc = func.docs(db).map(|it| it.into());
117117
format_to!(res.signature, "fn {}", func.name(db));
118-
fn_params = Some(func.assoc_fn_params(db));
118+
fn_params = Some(match func.self_param(db) {
119+
Some(_self) => func.params_without_self(db),
120+
None => func.assoc_fn_params(db),
121+
});
119122
}
120123
hir::CallableKind::TupleStruct(strukt) => {
121124
res.doc = strukt.docs(db).map(|it| it.into());
@@ -1036,6 +1039,25 @@ fn f() {
10361039
);
10371040
}
10381041

1042+
#[test]
1043+
fn test_generic_param_in_method_call() {
1044+
check(
1045+
r#"
1046+
struct Foo;
1047+
impl Foo {
1048+
fn test<V>(&mut self, val: V) {}
1049+
}
1050+
fn sup() {
1051+
Foo.test($0)
1052+
}
1053+
"#,
1054+
expect![[r#"
1055+
fn test(&mut self, val: V)
1056+
^^^^^^
1057+
"#]],
1058+
);
1059+
}
1060+
10391061
#[test]
10401062
fn test_generic_kinds() {
10411063
check(

0 commit comments

Comments
 (0)