diff options
author | Zac Pullar-Strecker <[email protected]> | 2020-06-30 10:16:12 +0100 |
---|---|---|
committer | Zac Pullar-Strecker <[email protected]> | 2020-06-30 10:16:12 +0100 |
commit | dc32f756e0958368648ac151aab1bde40102a506 (patch) | |
tree | 3c35dacb42e0872e30cfb81fb29ae77adae95ab3 /crates/ra_ide | |
parent | 3e22f80f443469f470561bceb2d84427ebab677f (diff) |
Format
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 16 |
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 | ||
4 | use hir::{ | 4 | use 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 | }; |
9 | use itertools::Itertools; | 9 | use itertools::Itertools; |
10 | use lazy_static::lazy_static; | 10 | use 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 | }; |
19 | use ra_syntax::{ | 19 | use ra_syntax::{ast, ast::Path, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset}; |
20 | ast, ast::Path, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, | ||
21 | }; | ||
22 | use ra_tt::{Ident, Leaf, Literal, TokenTree}; | 20 | use ra_tt::{Ident, Leaf, Literal, TokenTree}; |
23 | use url::Url; | 21 | use 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`). |