mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge #11481
11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj Implements #11474 The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier. I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work. Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
This commit is contained in:
commit
24255e5b3d
5 changed files with 105 additions and 24 deletions
|
@ -1310,6 +1310,60 @@ fn test_hover_function_show_qualifiers() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_function_show_types() {
|
||||
check(
|
||||
r#"fn foo$0(a: i32, b:i32) -> i32 { 0 }"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
fn foo(a: i32, b: i32) -> i32
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_function_pointer_show_identifiers() {
|
||||
check(
|
||||
r#"type foo$0 = fn(a: i32, b: i32) -> i32;"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
type foo = fn(a: i32, b: i32) -> i32
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_function_pointer_no_identifier() {
|
||||
check(
|
||||
r#"type foo$0 = fn(i32, _: i32) -> i32;"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
type foo = fn(i32, i32) -> i32
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_trait_show_qualifiers() {
|
||||
check_actions(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue