aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/display/short_label.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/display/short_label.rs')
-rw-r--r--crates/ide/src/display/short_label.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/crates/ide/src/display/short_label.rs b/crates/ide/src/display/short_label.rs
index 990f740b8..84b8883de 100644
--- a/crates/ide/src/display/short_label.rs
+++ b/crates/ide/src/display/short_label.rs
@@ -53,9 +53,19 @@ impl ShortLabel for ast::SourceFile {
53 } 53 }
54} 54}
55 55
56impl ShortLabel for ast::BlockExpr {
57 fn short_label(&self) -> Option<String> {
58 None
59 }
60}
61
56impl ShortLabel for ast::TypeAlias { 62impl ShortLabel for ast::TypeAlias {
57 fn short_label(&self) -> Option<String> { 63 fn short_label(&self) -> Option<String> {
58 short_label_from_node(self, "type ") 64 let mut buf = short_label_from_node(self, "type ")?;
65 if let Some(type_ref) = self.ty() {
66 format_to!(buf, " = {}", type_ref.syntax());
67 }
68 Some(buf)
59 } 69 }
60} 70}
61 71
@@ -90,7 +100,7 @@ impl ShortLabel for ast::Variant {
90impl ShortLabel for ast::ConstParam { 100impl ShortLabel for ast::ConstParam {
91 fn short_label(&self) -> Option<String> { 101 fn short_label(&self) -> Option<String> {
92 let mut buf = "const ".to_owned(); 102 let mut buf = "const ".to_owned();
93 buf.push_str(self.name()?.text().as_str()); 103 buf.push_str(self.name()?.text());
94 if let Some(type_ref) = self.ty() { 104 if let Some(type_ref) = self.ty() {
95 format_to!(buf, ": {}", type_ref.syntax()); 105 format_to!(buf, ": {}", type_ref.syntax());
96 } 106 }
@@ -117,6 +127,6 @@ where
117{ 127{
118 let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default(); 128 let mut buf = node.visibility().map(|v| format!("{} ", v.syntax())).unwrap_or_default();
119 buf.push_str(label); 129 buf.push_str(label);
120 buf.push_str(node.name()?.text().as_str()); 130 buf.push_str(node.name()?.text());
121 Some(buf) 131 Some(buf)
122} 132}