mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Implement hover for ConstParam
This commit is contained in:
parent
5771cad451
commit
0ae0909a16
2 changed files with 29 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue