aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authoroxalica <[email protected]>2021-03-14 12:03:39 +0000
committeroxalica <[email protected]>2021-03-15 17:04:20 +0000
commitef416e0154767619fcbfa0d1682b28bd338a8ce9 (patch)
treee73269dbb569f176e9bba1b16eb74731d63c94c2 /crates/ide
parent2bb8956a102cb2efbea35e414a8214fba2efcaf6 (diff)
Impl HirDisplay for function hover message
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/hover.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index f872b68cf..1e4c247c0 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -354,7 +354,7 @@ fn hover_for_definition(
354 }, 354 },
355 mod_path, 355 mod_path,
356 ), 356 ),
357 ModuleDef::Function(it) => from_def_source(db, it, mod_path), 357 ModuleDef::Function(it) => from_hir_fmt(db, it, mod_path),
358 ModuleDef::Adt(Adt::Struct(it)) => from_def_source(db, it, mod_path), 358 ModuleDef::Adt(Adt::Struct(it)) => from_def_source(db, it, mod_path),
359 ModuleDef::Adt(Adt::Union(it)) => from_def_source(db, it, mod_path), 359 ModuleDef::Adt(Adt::Union(it)) => from_def_source(db, it, mod_path),
360 ModuleDef::Adt(Adt::Enum(it)) => from_def_source(db, it, mod_path), 360 ModuleDef::Adt(Adt::Enum(it)) => from_def_source(db, it, mod_path),
@@ -383,6 +383,14 @@ fn hover_for_definition(
383 }, 383 },
384 }; 384 };
385 385
386 fn from_hir_fmt<D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup>
387 where
388 D: HasAttrs + HirDisplay,
389 {
390 let label = def.display(db).to_string();
391 from_def_source_labeled(db, def, Some(label), mod_path)
392 }
393
386 fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup> 394 fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup>
387 where 395 where
388 D: HasSource<Ast = A> + HasAttrs + Copy, 396 D: HasSource<Ast = A> + HasAttrs + Copy,