Show icons and counts in the project diagnostics tab

Max Brunsfeld and Nathan Sobo created

Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Change summary

crates/diagnostics/src/diagnostics.rs                  |  4 +-
crates/editor/src/items.rs                             | 23 ++---------
crates/zed/assets/icons/diagnostic-summary-error.svg   |  3 +
crates/zed/assets/icons/diagnostic-summary-warning.svg |  3 +
crates/zed/assets/icons/no.svg                         |  1 
crates/zed/assets/icons/warning.svg                    |  3 -
crates/zed/assets/themes/_base.toml                    |  4 +-
7 files changed, 15 insertions(+), 26 deletions(-)

Detailed changes

crates/diagnostics/src/diagnostics.rs 🔗

@@ -563,7 +563,7 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
         let summary_spacing = theme.tab_summary_spacing;
         Flex::row()
             .with_children([
-                Svg::new("icons/no.svg")
+                Svg::new("icons/diagnostic-summary-error.svg")
                     .with_color(style.label.text.color)
                     .constrained()
                     .with_width(icon_width)
@@ -574,7 +574,7 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
                 Label::new(self.summary.error_count.to_string(), style.label.clone())
                     .aligned()
                     .boxed(),
-                Svg::new("icons/warning.svg")
+                Svg::new("icons/diagnostic-summary-warning.svg")
                     .with_color(style.label.text.color)
                     .constrained()
                     .with_width(icon_width)

crates/editor/src/items.rs 🔗

@@ -330,24 +330,11 @@ impl View for DiagnosticMessage {
     fn render(&mut self, _: &mut RenderContext<Self>) -> ElementBox {
         if let Some(diagnostic) = &self.diagnostic {
             let theme = &self.settings.borrow().theme.workspace.status_bar;
-            Flex::row()
-                .with_child(
-                    Svg::new("icons/warning.svg")
-                        .with_color(theme.diagnostic_icon_color)
-                        .constrained()
-                        .with_height(theme.diagnostic_icon_size)
-                        .contained()
-                        .with_margin_right(theme.diagnostic_icon_spacing)
-                        .boxed(),
-                )
-                .with_child(
-                    Label::new(
-                        diagnostic.message.lines().next().unwrap().to_string(),
-                        theme.diagnostic_message.clone(),
-                    )
-                    .boxed(),
-                )
-                .boxed()
+            Label::new(
+                diagnostic.message.lines().next().unwrap().to_string(),
+                theme.diagnostic_message.clone(),
+            )
+            .boxed()
         } else {
             Empty::new().boxed()
         }

crates/zed/assets/icons/diagnostic-summary-error.svg 🔗

@@ -0,0 +1,3 @@
+<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 13C10.0899 13 13 10.0899 13 6.5C13 2.91015 10.0899 0 6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13ZM3.48798 4.63702L5.35095 6.5L3.48798 8.36298L4.63702 9.51202L6.5 7.64905L8.36298 9.51202L9.51202 8.36298L7.64905 6.5L9.51202 4.63702L8.36298 3.48798L6.5 5.35095L4.63702 3.48798L3.48798 4.63702Z" fill="white" fill-opacity="0.6"/>
+</svg>

crates/zed/assets/icons/diagnostic-summary-warning.svg 🔗

@@ -0,0 +1,3 @@
+<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M13 13H0V10.4L5.6875 0H7.3125L13 10.4V13ZM5.6875 3.46667H7.3125V7.8H5.6875V3.46667ZM5.6875 9.53333H7.3125V11.2667H5.6875V9.53333Z" fill="white" fill-opacity="0.6"/>
+</svg>

crates/zed/assets/icons/warning.svg 🔗

@@ -1,3 +0,0 @@
-<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M0.577381 9.14286C0.414683 9.14286 0.277778 9.0873 0.166667 8.97619C0.0555556 8.86508 0 8.72817 0 8.56548C0 8.50992 0.00793651 8.45635 0.0238095 8.40476C0.0396825 8.35317 0.0595238 8.30556 0.0833333 8.2619L4.44643 0.369048C4.58135 0.123016 4.76587 0 5 0C5.23413 0 5.41865 0.123016 5.55357 0.369048L9.91667 8.2619C9.94048 8.30556 9.96032 8.35317 9.97619 8.40476C9.99206 8.45635 10 8.50992 10 8.56548C10 8.72817 9.94444 8.86508 9.83333 8.97619C9.72222 9.0873 9.58532 9.14286 9.42262 9.14286H0.577381ZM5.9881 2.40476H4.01786V3.77976L4.31548 5.61905H5.69048L5.9881 3.77976V2.40476ZM6 7.375C6 7.09722 5.90079 6.8631 5.70238 6.67262C5.50794 6.47817 5.27381 6.38095 5 6.38095C4.72619 6.38095 4.49206 6.47817 4.29762 6.67262C4.10714 6.8631 4.0119 7.09722 4.0119 7.375C4.0119 7.64881 4.10714 7.88095 4.29762 8.07143C4.49206 8.2619 4.72619 8.35714 5 8.35714C5.27381 8.35714 5.50794 8.2619 5.70238 8.07143C5.90079 7.88095 6 7.64881 6 7.375Z" fill="white"/>
-</svg>

crates/zed/assets/themes/_base.toml 🔗

@@ -316,6 +316,6 @@ message.highlight_text.color = "$text.3.color"
 background = "$surface.1"
 empty_message = "$text.0"
 status_bar_item = { extends = "$text.2", margin.right = 10 }
-tab_icon_width = 9
-tab_icon_spacing = 3
+tab_icon_width = 13
+tab_icon_spacing = 4
 tab_summary_spacing = 10