aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/hover.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r--crates/ide/src/hover.rs47
1 files changed, 24 insertions, 23 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 4e1ab534b..0c1da8774 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -563,8 +563,6 @@ mod tests {
563 563
564 use crate::fixture; 564 use crate::fixture;
565 565
566 use super::*;
567
568 fn check_hover_no_result(ra_fixture: &str) { 566 fn check_hover_no_result(ra_fixture: &str) {
569 let (analysis, position) = fixture::position(ra_fixture); 567 let (analysis, position) = fixture::position(ra_fixture);
570 assert!(analysis.hover(position, true, true, true).unwrap().is_none()); 568 assert!(analysis.hover(position, true, true, true).unwrap().is_none());
@@ -1816,9 +1814,10 @@ pub struct B$0ar
1816 ); 1814 );
1817 } 1815 }
1818 1816
1819 #[ignore = "path based links currently only support documentation on ModuleDef items"]
1820 #[test] 1817 #[test]
1821 fn test_hover_path_link_field() { 1818 fn test_hover_path_link_field() {
1819 // FIXME: Should be
1820 // [Foo](https://docs.rs/test/*/test/struct.Foo.html)
1822 check( 1821 check(
1823 r#" 1822 r#"
1824pub struct Foo; 1823pub struct Foo;
@@ -1840,7 +1839,7 @@ pub struct Bar {
1840 1839
1841 --- 1840 ---
1842 1841
1843 [Foo](https://docs.rs/test/*/test/struct.Foo.html) 1842 [Foo](struct.Foo.html)
1844 "#]], 1843 "#]],
1845 ); 1844 );
1846 } 1845 }
@@ -2254,7 +2253,7 @@ pub fn fo$0o() {}
2254 case 13. collapsed link: foo 2253 case 13. collapsed link: foo
2255 case 14. shortcut link: foo 2254 case 14. shortcut link: foo
2256 case 15. inline without URL: foo 2255 case 15. inline without URL: foo
2257 case 16. just escaped text: \[foo] 2256 case 16. just escaped text: \[foo\]
2258 case 17. inline link: Foo 2257 case 17. inline link: Foo
2259 2258
2260 [^example]: https://www.example.com/ 2259 [^example]: https://www.example.com/
@@ -2994,29 +2993,24 @@ fn foo(ar$0g: &impl Foo + Bar<S>) {}
2994 fn test_hover_async_block_impl_trait_has_goto_type_action() { 2993 fn test_hover_async_block_impl_trait_has_goto_type_action() {
2995 check_actions( 2994 check_actions(
2996 r#" 2995 r#"
2996//- minicore: future
2997struct S; 2997struct S;
2998fn foo() { 2998fn foo() {
2999 let fo$0o = async { S }; 2999 let fo$0o = async { S };
3000} 3000}
3001
3002#[prelude_import] use future::*;
3003mod future {
3004 #[lang = "future_trait"]
3005 pub trait Future { type Output; }
3006}
3007"#, 3001"#,
3008 expect![[r#" 3002 expect![[r#"
3009 [ 3003 [
3010 GoToType( 3004 GoToType(
3011 [ 3005 [
3012 HoverGotoTypeData { 3006 HoverGotoTypeData {
3013 mod_path: "test::future::Future", 3007 mod_path: "core::future::Future",
3014 nav: NavigationTarget { 3008 nav: NavigationTarget {
3015 file_id: FileId( 3009 file_id: FileId(
3016 0, 3010 1,
3017 ), 3011 ),
3018 full_range: 101..163, 3012 full_range: 251..433,
3019 focus_range: 140..146, 3013 focus_range: 290..296,
3020 name: "Future", 3014 name: "Future",
3021 kind: Trait, 3015 kind: Trait,
3022 description: "pub trait Future", 3016 description: "pub trait Future",
@@ -3812,11 +3806,14 @@ use foo::bar::{self$0};
3812 3806
3813 #[test] 3807 #[test]
3814 fn hover_keyword() { 3808 fn hover_keyword() {
3815 let ra_fixture = r#"//- /main.rs crate:main deps:std
3816fn f() { retur$0n; }"#;
3817 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3818 check( 3809 check(
3819 &fixture, 3810 r#"
3811//- /main.rs crate:main deps:std
3812fn f() { retur$0n; }
3813//- /libstd.rs crate:std
3814/// Docs for return_keyword
3815mod return_keyword {}
3816"#,
3820 expect![[r#" 3817 expect![[r#"
3821 *return* 3818 *return*
3822 3819
@@ -3833,11 +3830,15 @@ fn f() { retur$0n; }"#;
3833 3830
3834 #[test] 3831 #[test]
3835 fn hover_builtin() { 3832 fn hover_builtin() {
3836 let ra_fixture = r#"//- /main.rs crate:main deps:std
3837cosnt _: &str$0 = ""; }"#;
3838 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3839 check( 3833 check(
3840 &fixture, 3834 r#"
3835//- /main.rs crate:main deps:std
3836cosnt _: &str$0 = ""; }
3837
3838//- /libstd.rs crate:std
3839/// Docs for prim_str
3840mod prim_str {}
3841"#,
3841 expect![[r#" 3842 expect![[r#"
3842 *str* 3843 *str*
3843 3844