aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/display
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-01-04 13:18:31 +0000
committerLukas Wirth <[email protected]>2021-01-04 13:18:31 +0000
commit0ae0909a1676903baf33999d5f23d51fb838111b (patch)
tree53c456c75f3d136dc2b63c64bf20a012e0d0efc8 /crates/ide/src/display
parent5771cad4517005afe134d0b9c93571c177f14db4 (diff)
Implement hover for ConstParam
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r--crates/ide/src/display/short_label.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ide/src/display/short_label.rs b/crates/ide/src/display/short_label.rs
index ea49d9f97..990f740b8 100644
--- a/crates/ide/src/display/short_label.rs
+++ b/crates/ide/src/display/short_label.rs
@@ -87,6 +87,17 @@ impl ShortLabel for ast::Variant {
87 } 87 }
88} 88}
89 89
90impl ShortLabel for ast::ConstParam {
91 fn short_label(&self) -> Option<String> {
92 let mut buf = "const ".to_owned();
93 buf.push_str(self.name()?.text().as_str());
94 if let Some(type_ref) = self.ty() {
95 format_to!(buf, ": {}", type_ref.syntax());
96 }
97 Some(buf)
98 }
99}
100
90fn short_label_from_ty<T>(node: &T, ty: Option<ast::Type>, prefix: &str) -> Option<String> 101fn short_label_from_ty<T>(node: &T, ty: Option<ast::Type>, prefix: &str) -> Option<String>
91where 102where
92 T: NameOwner + VisibilityOwner, 103 T: NameOwner + VisibilityOwner,