Implement hover for ConstParam

This commit is contained in:
Lukas Wirth 2021-01-04 14:18:31 +01:00
parent 5771cad451
commit 0ae0909a16
2 changed files with 29 additions and 4 deletions

View file

@ -87,6 +87,17 @@ impl ShortLabel for ast::Variant {
}
}
impl ShortLabel for ast::ConstParam {
fn short_label(&self) -> Option<String> {
let mut buf = "const ".to_owned();
buf.push_str(self.name()?.text().as_str());
if let Some(type_ref) = self.ty() {
format_to!(buf, ": {}", type_ref.syntax());
}
Some(buf)
}
}
fn short_label_from_ty<T>(node: &T, ty: Option<ast::Type>, prefix: &str) -> Option<String>
where
T: NameOwner + VisibilityOwner,