mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
show function params in completion detail
This commit is contained in:
parent
437527b226
commit
53bb46fa85
8 changed files with 155 additions and 82 deletions
|
@ -424,6 +424,44 @@ fn main() { Foo::Fo$0 }
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fn_detail_includes_args_and_return_type() {
|
||||
check(
|
||||
r#"
|
||||
fn foo<T>(a: u32, b: u32, t: T) -> (u32, T) { (a, t) }
|
||||
|
||||
fn main() { fo$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
[
|
||||
CompletionItem {
|
||||
label: "foo(…)",
|
||||
source_range: 68..70,
|
||||
delete: 68..70,
|
||||
insert: "foo(${1:a}, ${2:b}, ${3:t})$0",
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
lookup: "foo",
|
||||
detail: "fn(u32, u32, T) -> (u32, T)",
|
||||
trigger_call_info: true,
|
||||
},
|
||||
CompletionItem {
|
||||
label: "main()",
|
||||
source_range: 68..70,
|
||||
delete: 68..70,
|
||||
insert: "main()$0",
|
||||
kind: SymbolKind(
|
||||
Function,
|
||||
),
|
||||
lookup: "main",
|
||||
detail: "fn()",
|
||||
},
|
||||
]
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enum_detail_just_parentheses_for_unit() {
|
||||
check(
|
||||
|
@ -501,7 +539,7 @@ fn main() { let _: m::Spam = S$0 }
|
|||
Function,
|
||||
),
|
||||
lookup: "main",
|
||||
detail: "-> ()",
|
||||
detail: "fn()",
|
||||
},
|
||||
]
|
||||
"#]],
|
||||
|
@ -530,7 +568,7 @@ fn main() { som$0 }
|
|||
Function,
|
||||
),
|
||||
lookup: "main",
|
||||
detail: "-> ()",
|
||||
detail: "fn()",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "something_deprecated()",
|
||||
|
@ -541,7 +579,7 @@ fn main() { som$0 }
|
|||
Function,
|
||||
),
|
||||
lookup: "something_deprecated",
|
||||
detail: "-> ()",
|
||||
detail: "fn()",
|
||||
deprecated: true,
|
||||
},
|
||||
CompletionItem {
|
||||
|
@ -553,7 +591,7 @@ fn main() { som$0 }
|
|||
Function,
|
||||
),
|
||||
lookup: "something_else_deprecated",
|
||||
detail: "-> ()",
|
||||
detail: "fn()",
|
||||
deprecated: true,
|
||||
},
|
||||
]
|
||||
|
@ -604,7 +642,7 @@ impl S {
|
|||
insert: "bar()$0",
|
||||
kind: Method,
|
||||
lookup: "bar",
|
||||
detail: "-> ()",
|
||||
detail: "fn(self)",
|
||||
documentation: Documentation(
|
||||
"Method docs",
|
||||
),
|
||||
|
@ -704,7 +742,7 @@ fn foo(s: S) { s.$0 }
|
|||
insert: "the_method()$0",
|
||||
kind: Method,
|
||||
lookup: "the_method",
|
||||
detail: "-> ()",
|
||||
detail: "fn(&self)",
|
||||
},
|
||||
]
|
||||
"#]],
|
||||
|
@ -954,7 +992,7 @@ fn main() {
|
|||
Function,
|
||||
),
|
||||
lookup: "foo",
|
||||
detail: "-> ()",
|
||||
detail: "fn(&mut S)",
|
||||
trigger_call_info: true,
|
||||
},
|
||||
CompletionItem {
|
||||
|
@ -966,7 +1004,7 @@ fn main() {
|
|||
Function,
|
||||
),
|
||||
lookup: "main",
|
||||
detail: "-> ()",
|
||||
detail: "fn()",
|
||||
},
|
||||
CompletionItem {
|
||||
label: "s",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue