mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
signature_help
: use corresponding param list for methods
This commit is contained in:
parent
1b120216de
commit
729cd8530b
1 changed files with 23 additions and 1 deletions
|
@ -115,7 +115,10 @@ 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(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) => {
|
hir::CallableKind::TupleStruct(strukt) => {
|
||||||
res.doc = strukt.docs(db).map(|it| it.into());
|
res.doc = strukt.docs(db).map(|it| it.into());
|
||||||
|
@ -1036,6 +1039,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]
|
#[test]
|
||||||
fn test_generic_kinds() {
|
fn test_generic_kinds() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue