diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-23 12:09:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-23 12:09:24 +0100 |
commit | 88c292b1c29d824dcb9726a1ea146fe5b9c97028 (patch) | |
tree | 8b16648c3081bb1224d77b6e81d2764b7dc35a10 /crates/ra_ide/src/hover.rs | |
parent | d4daca9f02ec46be1beef79e9ed647a3a24e2434 (diff) | |
parent | 6197a960dffa4c7e8c2f60168a476e5f39ba50aa (diff) |
Merge #4559
4559: Module name on hover shows another newline after it r=matklad a=Arthamys
This changes the display of hover information to add a newline between the module path of the item and the signature of the item, as suggested in #3813
**Before**
![before_3813](https://user-images.githubusercontent.com/11710698/82609224-5d517d80-9bbc-11ea-9a08-0a1558409c6b.png)
**After**
![after_3813](https://user-images.githubusercontent.com/11710698/82609208-562a6f80-9bbc-11ea-8cb6-4430269c5800.png)
Co-authored-by: Galilée 'Bill' Enguehard <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/hover.rs')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index befa977c7..1f4f6b848 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -405,7 +405,7 @@ mod tests { | |||
405 | }; | 405 | }; |
406 | } | 406 | } |
407 | "#, | 407 | "#, |
408 | &["Foo\nfield_a: u32"], | 408 | &["Foo\n___\n\n```rust\nfield_a: u32"], |
409 | ); | 409 | ); |
410 | 410 | ||
411 | // Hovering over the field in the definition | 411 | // Hovering over the field in the definition |
@@ -422,7 +422,7 @@ mod tests { | |||
422 | }; | 422 | }; |
423 | } | 423 | } |
424 | "#, | 424 | "#, |
425 | &["Foo\nfield_a: u32"], | 425 | &["Foo\n___\n\n```rust\nfield_a: u32"], |
426 | ); | 426 | ); |
427 | } | 427 | } |
428 | 428 | ||
@@ -475,7 +475,7 @@ fn main() { | |||
475 | ", | 475 | ", |
476 | ); | 476 | ); |
477 | let hover = analysis.hover(position).unwrap().unwrap(); | 477 | let hover = analysis.hover(position).unwrap().unwrap(); |
478 | assert_eq!(trim_markup_opt(hover.info.first()), Some("Option\nSome")); | 478 | assert_eq!(trim_markup_opt(hover.info.first()), Some("Option\n___\n\n```rust\nSome")); |
479 | 479 | ||
480 | let (analysis, position) = single_file_with_position( | 480 | let (analysis, position) = single_file_with_position( |
481 | " | 481 | " |
@@ -503,6 +503,9 @@ fn main() { | |||
503 | "#, | 503 | "#, |
504 | &[" | 504 | &[" |
505 | Option | 505 | Option |
506 | ___ | ||
507 | |||
508 | ```rust | ||
506 | None | 509 | None |
507 | ``` | 510 | ``` |
508 | 511 | ||
@@ -524,6 +527,9 @@ The None variant | |||
524 | "#, | 527 | "#, |
525 | &[" | 528 | &[" |
526 | Option | 529 | Option |
530 | ___ | ||
531 | |||
532 | ```rust | ||
527 | Some | 533 | Some |
528 | ``` | 534 | ``` |
529 | 535 | ||
@@ -606,7 +612,10 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
606 | ", | 612 | ", |
607 | ); | 613 | ); |
608 | let hover = analysis.hover(position).unwrap().unwrap(); | 614 | let hover = analysis.hover(position).unwrap().unwrap(); |
609 | assert_eq!(trim_markup_opt(hover.info.first()), Some("wrapper::Thing\nfn new() -> Thing")); | 615 | assert_eq!( |
616 | trim_markup_opt(hover.info.first()), | ||
617 | Some("wrapper::Thing\n___\n\n```rust\nfn new() -> Thing") | ||
618 | ); | ||
610 | } | 619 | } |
611 | 620 | ||
612 | #[test] | 621 | #[test] |