aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/hover.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/hover.rs')
-rw-r--r--crates/ra_ide/src/hover.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 475ceadd1..3bdd61a2e 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -67,10 +67,10 @@ fn hover_text(
67 desc: Option<String>, 67 desc: Option<String>,
68 mod_path: Option<String>, 68 mod_path: Option<String>,
69) -> Option<String> { 69) -> Option<String> {
70 match (desc, docs, mod_path) { 70 if let Some(desc) = desc {
71 (Some(desc), docs, mod_path) => Some(rust_code_markup_with_doc(desc, docs, mod_path)), 71 Some(rust_code_markup_with_doc(&desc, docs.as_deref(), mod_path.as_deref()))
72 (None, Some(docs), _) => Some(docs), 72 } else {
73 _ => None, 73 docs
74 } 74 }
75} 75}
76 76
@@ -106,7 +106,7 @@ fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> {
106 .flatten() 106 .flatten()
107 .join("::") 107 .join("::")
108 }); 108 });
109 mod_path 109 mod_path // FIXME: replace dashes with underscores in crate display name
110} 110}
111 111
112fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<String> { 112fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<String> {
@@ -143,9 +143,7 @@ fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<Strin
143 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path), 143 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path),
144 ModuleDef::BuiltinType(it) => Some(it.to_string()), 144 ModuleDef::BuiltinType(it) => Some(it.to_string()),
145 }, 145 },
146 Definition::Local(it) => { 146 Definition::Local(it) => Some(rust_code_markup(&it.ty(db).display_truncated(db, None))),
147 Some(rust_code_markup(it.ty(db).display_truncated(db, None).to_string()))
148 }
149 Definition::TypeParam(_) | Definition::SelfType(_) => { 147 Definition::TypeParam(_) | Definition::SelfType(_) => {
150 // FIXME: Hover for generic param 148 // FIXME: Hover for generic param
151 None 149 None
@@ -210,7 +208,7 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
210 } 208 }
211 }?; 209 }?;
212 210
213 res.extend(Some(rust_code_markup(ty.display_truncated(db, None).to_string()))); 211 res.extend(Some(rust_code_markup(&ty.display_truncated(db, None))));
214 let range = sema.original_range(&node).range; 212 let range = sema.original_range(&node).range;
215 Some(RangeInfo::new(range, res)) 213 Some(RangeInfo::new(range, res))
216} 214}