diff options
Diffstat (limited to 'crates/ide/src/doc_links.rs')
-rw-r--r-- | crates/ide/src/doc_links.rs | 18 |
1 files changed, 12 insertions, 6 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 | } |