diff options
| author | bors <bors@rust-lang.org> | 2022-04-26 07:34:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-04-26 07:34:00 +0000 |
| commit | a8bc625f5ad14e6289741cf4a5299eddcdd96680 (patch) | |
| tree | 8c7c135cd1741b6a3a388933ef86e6ef9dc4025f | |
| parent | 1b120216de987f2e7700b7707ef6b5d5b5545d94 (diff) | |
| parent | 729cd8530bc256a64aa09435d3fc7b632d79cff3 (diff) | |
| download | rust-a8bc625f5ad14e6289741cf4a5299eddcdd96680.tar.gz rust-a8bc625f5ad14e6289741cf4a5299eddcdd96680.zip | |
Auto merge of #12082 - iDawer:ide.signature_help, r=lnicola
fix: `signature_help`: use corresponding param list for methods Close #12079
| -rw-r--r-- | crates/ide/src/signature_help.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs index 4eca69033a6..50187c933d3 100644 --- a/crates/ide/src/signature_help.rs +++ b/crates/ide/src/signature_help.rs @@ -115,7 +115,10 @@ fn signature_help_for_call( hir::CallableKind::Function(func) => { res.doc = func.docs(db).map(|it| it.into()); format_to!(res.signature, "fn {}", func.name(db)); - fn_params = Some(func.assoc_fn_params(db)); + fn_params = Some(match func.self_param(db) { + Some(_self) => func.params_without_self(db), + None => func.assoc_fn_params(db), + }); } hir::CallableKind::TupleStruct(strukt) => { res.doc = strukt.docs(db).map(|it| it.into()); @@ -1037,6 +1040,25 @@ fn f() { } #[test] + fn test_generic_param_in_method_call() { + check( + r#" +struct Foo; +impl Foo { + fn test<V>(&mut self, val: V) {} +} +fn sup() { + Foo.test($0) +} +"#, + expect![[r#" + fn test(&mut self, val: V) + ^^^^^^ + "#]], + ); + } + + #[test] fn test_generic_kinds() { check( r#" |
