aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/hover.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 78a661c85..f36b9de7e 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -3,8 +3,8 @@ use std::iter::once;
3 3
4use hir::{ 4use hir::{
5 db::DefDatabase, Adt, AsAssocItem, AsName, AssocItemContainer, AttrDef, Crate, Documentation, 5 db::DefDatabase, Adt, AsAssocItem, AsName, AssocItemContainer, AttrDef, Crate, Documentation,
6 FieldSource, HasSource, HirDisplay, Hygiene, ItemInNs, ModPath, ModuleDef, ModuleSource, 6 FieldSource, HasSource, HirDisplay, Hygiene, ItemInNs, ModPath, Module, ModuleDef,
7 Semantics, Module 7 ModuleSource, Semantics,
8}; 8};
9use itertools::Itertools; 9use itertools::Itertools;
10use lazy_static::lazy_static; 10use lazy_static::lazy_static;
@@ -16,9 +16,7 @@ use ra_ide_db::{
16 defs::{classify_name, classify_name_ref, Definition}, 16 defs::{classify_name, classify_name_ref, Definition},
17 RootDatabase, 17 RootDatabase,
18}; 18};
19use ra_syntax::{ 19use ra_syntax::{ast, ast::Path, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset};
20 ast, ast::Path, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset,
21};
22use ra_tt::{Ident, Leaf, Literal, TokenTree}; 20use ra_tt::{Ident, Leaf, Literal, TokenTree};
23use url::Url; 21use url::Url;
24 22
@@ -441,8 +439,9 @@ fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) ->
441 // Two posibilities: 439 // Two posibilities:
442 // * path-based links: `../../module/struct.MyStruct.html` 440 // * path-based links: `../../module/struct.MyStruct.html`
443 // * module-based links (AKA intra-doc links): `super::super::module::MyStruct` 441 // * module-based links (AKA intra-doc links): `super::super::module::MyStruct`
444 let resolved = try_resolve_intra(db, definition, title, &target) 442 let resolved = try_resolve_intra(db, definition, title, &target).or_else(|| {
445 .or_else(|| try_resolve_path(db, definition, &target).map(|target| (target, title.to_string()))); 443 try_resolve_path(db, definition, &target).map(|target| (target, title.to_string()))
444 });
446 445
447 if let Some((target, title)) = resolved { 446 if let Some((target, title)) = resolved {
448 (target, title) 447 (target, title)
@@ -575,7 +574,8 @@ fn try_resolve_intra(
575 .join(&get_symbol_filename(db, &Definition::ModuleDef(def))?) 574 .join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)
576 .ok()? 575 .ok()?
577 .into_string(), 576 .into_string(),
578 strip_prefixes_suffixes(link_text).to_string())) 577 strip_prefixes_suffixes(link_text).to_string(),
578 ))
579} 579}
580 580
581/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`). 581/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).