aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/display/short_label.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-10 10:55:58 +0100
committerGitHub <[email protected]>2020-08-10 10:55:58 +0100
commitf3336509e52187a7a70a8043557a7317872e3a2f (patch)
treed9eb3f88c60add9d7bfc050c8fb52f2033e238cb /crates/ra_ide/src/display/short_label.rs
parent7a03f05eac4ff1e9ca4ceeced54ce06892bd30b8 (diff)
parent958b91c1e8394129216d1b8378d726f937592d3f (diff)
Merge #5698
5698: Display the value of a const on the hover r=jonas-schievink a=JmPotato Signed-off-by: JmPotato <[email protected]> Close #4051 To display the value of a const, I modified the implementation of `ShortLabel` for `ast::Const`. Co-authored-by: JmPotato <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/display/short_label.rs')
-rw-r--r--crates/ra_ide/src/display/short_label.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index b5ff9fa2d..010c34705 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 {
61 61
62impl ShortLabel for ast::Const { 62impl ShortLabel for ast::Const {
63 fn short_label(&self) -> Option<String> { 63 fn short_label(&self) -> Option<String> {
64 short_label_from_ty(self, self.ty(), "const ") 64 let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?;
65 if let Some(expr) = self.body() {
66 format_to!(new_buf, " = {}", expr.syntax());
67 }
68 Some(new_buf)
65 } 69 }
66} 70}
67 71