diff options
| author | iDawer <ilnur.iskhakov.oss@outlook.com> | 2022-05-10 17:18:42 +0500 |
|---|---|---|
| committer | iDawer <ilnur.iskhakov.oss@outlook.com> | 2022-05-10 17:18:42 +0500 |
| commit | 956b8fb9540a849fca98b09d016c71b76160dd2e (patch) | |
| tree | 2d81922336d44224fef1c67b07d90efa8d22870f | |
| parent | ad6df5b12e61cb7779bfc92c08f1ff0ee37c4f2d (diff) | |
| download | rust-956b8fb9540a849fca98b09d016c71b76160dd2e.tar.gz rust-956b8fb9540a849fca98b09d016c71b76160dd2e.zip | |
`signature_help`: detect fully qualified call syntax for parameter fallback
| -rw-r--r-- | crates/ide/src/signature_help.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ide/src/signature_help.rs b/crates/ide/src/signature_help.rs index 57b0305fb35..e603cb4862d 100644 --- a/crates/ide/src/signature_help.rs +++ b/crates/ide/src/signature_help.rs @@ -129,7 +129,7 @@ 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(match func.self_param(db) { + fn_params = Some(match callable.receiver_param(db) { Some(_self) => func.params_without_self(db), None => func.assoc_fn_params(db), }); @@ -1142,4 +1142,20 @@ fn f() { "#]], ); } + + #[test] + fn fully_qualified_syntax() { + check( + r#" +fn f() { + trait A { fn foo(&self, other: Self); } + A::foo(&self$0, other); +} +"#, + expect![[r#" + fn foo(self: &Self, other: Self) + ^^^^^^^^^^^ ----------- + "#]], + ); + } } |
