mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
signature_help
: detect fully qualified call syntax for parameter fallback
This commit is contained in:
parent
ad6df5b12e
commit
956b8fb954
1 changed files with 17 additions and 1 deletions
|
@ -129,7 +129,7 @@ fn signature_help_for_call(
|
||||||
hir::CallableKind::Function(func) => {
|
hir::CallableKind::Function(func) => {
|
||||||
res.doc = func.docs(db).map(|it| it.into());
|
res.doc = func.docs(db).map(|it| it.into());
|
||||||
format_to!(res.signature, "fn {}", func.name(db));
|
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),
|
Some(_self) => func.params_without_self(db),
|
||||||
None => func.assoc_fn_params(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)
|
||||||
|
^^^^^^^^^^^ -----------
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue