diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index b5ff9fa2de..010c34705c 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -61,7 +61,11 @@ impl ShortLabel for ast::TypeAlias { impl ShortLabel for ast::Const { fn short_label(&self) -> Option { - short_label_from_ty(self, self.ty(), "const ") + let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?; + if let Some(expr) = self.body() { + format_to!(new_buf, " = {}", expr.syntax()); + } + Some(new_buf) } } diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 9c7348898a..f66f62bfb5 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -590,16 +590,16 @@ fn main() { #[test] fn hover_const_static() { check( - r#"const foo<|>: u32 = 0;"#, + r#"const foo<|>: u32 = 123;"#, expect![[r#" *foo* ```rust - const foo: u32 + const foo: u32 = 123 ``` "#]], ); check( - r#"static foo<|>: u32 = 0;"#, + r#"static foo<|>: u32 = 456;"#, expect![[r#" *foo* ```rust @@ -834,7 +834,7 @@ fn main() { expect![[r#" *C* ```rust - const C: u32 + const C: u32 = 1 ``` "#]], )