diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/doc_links.rs | 18 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 5 |
2 files changed, 15 insertions, 8 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 57ae9455b..7ac0118fe 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -241,6 +241,10 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> { | |||
241 | Definition::ModuleDef(ModuleDef::Module(module)) => module.krate(), | 241 | Definition::ModuleDef(ModuleDef::Module(module)) => module.krate(), |
242 | _ => definition.module(db)?.krate(), | 242 | _ => definition.module(db)?.krate(), |
243 | }; | 243 | }; |
244 | // FIXME: using import map doesn't make sense here. What we want here is | ||
245 | // canonical path. What import map returns is the shortest path suitable for | ||
246 | // import. See this test: | ||
247 | cov_mark::hit!(test_reexport_order); | ||
244 | let import_map = db.import_map(krate.into()); | 248 | let import_map = db.import_map(krate.into()); |
245 | 249 | ||
246 | let mut base = krate.display_name(db)?.to_string(); | 250 | let mut base = krate.display_name(db)?.to_string(); |
@@ -642,13 +646,15 @@ pub mod foo { | |||
642 | ) | 646 | ) |
643 | } | 647 | } |
644 | 648 | ||
645 | // FIXME: ImportMap will return re-export paths instead of public module | ||
646 | // paths. The correct path to documentation will never be a re-export. | ||
647 | // This problem stops us from resolving stdlib items included in the prelude | ||
648 | // such as `Option::Some` correctly. | ||
649 | #[ignore = "ImportMap may return re-exports"] | ||
650 | #[test] | 649 | #[test] |
651 | fn test_reexport_order() { | 650 | fn test_reexport_order() { |
651 | cov_mark::check!(test_reexport_order); | ||
652 | // FIXME: This should return | ||
653 | // | ||
654 | // https://docs.rs/test/*/test/wrapper/modulestruct.Item.html | ||
655 | // | ||
656 | // That is, we should point inside the module, rather than at the | ||
657 | // re-export. | ||
652 | check( | 658 | check( |
653 | r#" | 659 | r#" |
654 | pub mod wrapper { | 660 | pub mod wrapper { |
@@ -663,7 +669,7 @@ fn foo() { | |||
663 | let bar: wrapper::It$0em; | 669 | let bar: wrapper::It$0em; |
664 | } | 670 | } |
665 | "#, | 671 | "#, |
666 | expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]], | 672 | expect![[r#"https://docs.rs/test/*/test/wrapper/struct.Item.html"#]], |
667 | ) | 673 | ) |
668 | } | 674 | } |
669 | } | 675 | } |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index c08516805..afeded315 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -1821,9 +1821,10 @@ pub struct B$0ar | |||
1821 | ); | 1821 | ); |
1822 | } | 1822 | } |
1823 | 1823 | ||
1824 | #[ignore = "path based links currently only support documentation on ModuleDef items"] | ||
1825 | #[test] | 1824 | #[test] |
1826 | fn test_hover_path_link_field() { | 1825 | fn test_hover_path_link_field() { |
1826 | // FIXME: Should be | ||
1827 | // [Foo](https://docs.rs/test/*/test/struct.Foo.html) | ||
1827 | check( | 1828 | check( |
1828 | r#" | 1829 | r#" |
1829 | pub struct Foo; | 1830 | pub struct Foo; |
@@ -1845,7 +1846,7 @@ pub struct Bar { | |||
1845 | 1846 | ||
1846 | --- | 1847 | --- |
1847 | 1848 | ||
1848 | [Foo](https://docs.rs/test/*/test/struct.Foo.html) | 1849 | [Foo](struct.Foo.html) |
1849 | "#]], | 1850 | "#]], |
1850 | ); | 1851 | ); |
1851 | } | 1852 | } |