Show icons and counts in the project diagnostics tab

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2022-01-25 12:31:55 -08:00
co-authored by Nathan Sobo
parent c9b4bb78f2
commit dbe969893c
7 changed files with 15 additions and 29 deletions
+2 -2
View File
@@ -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)
+5 -18
View File
@@ -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()
}
@@ -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>

After

Width:  |  Height:  |  Size: 499 B

@@ -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>

After

Width:  |  Height:  |  Size: 317 B

-4
View File
@@ -1,4 +0,0 @@
<svg width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.5 9C4.11176 9 3.72353 8.95294 3.33529 8.85882C2.94706 8.75294 2.58235 8.6 2.24118 8.4C1.9 8.2 1.58824 7.96471 1.30588 7.69412C1.03529 7.41177 0.8 7.1 0.6 6.75882C0.4 6.41765 0.247059 6.05294 0.141177 5.66471C0.0470589 5.27647 0 4.88824 0 4.5C0 4.11176 0.0470589 3.72353 0.141177 3.33529C0.247059 2.94706 0.4 2.58235 0.6 2.24118C0.8 1.9 1.03529 1.59412 1.30588 1.32353C1.58824 1.04118 1.9 0.799999 2.24118 0.599999C2.58235 0.4 2.94706 0.252941 3.33529 0.158823C3.72353 0.0529408 4.11176 0 4.5 0C4.88824 0 5.27647 0.0529408 5.66471 0.158823C6.05294 0.252941 6.41765 0.4 6.75882 0.599999C7.1 0.799999 7.40588 1.04118 7.67647 1.32353C7.95882 1.59412 8.2 1.9 8.4 2.24118C8.6 2.58235 8.74706 2.94706 8.84118 3.33529C8.94706 3.72353 9 4.11176 9 4.5C9 4.88824 8.94706 5.27647 8.84118 5.66471C8.74706 6.05294 8.6 6.41765 8.4 6.75882C8.2 7.1 7.95882 7.41177 7.67647 7.69412C7.40588 7.96471 7.1 8.2 6.75882 8.4C6.41765 8.6 6.05294 8.75294 5.66471 8.85882C5.27647 8.95294 4.88824 9 4.5 9ZM1.97647 5.92941L6.03529 1.88823C5.81176 1.72353 5.56471 1.6 5.29412 1.51765C5.03529 1.43529 4.77059 1.39412 4.5 1.39412C4.11176 1.39412 3.73529 1.48235 3.37059 1.65882C3.01765 1.82353 2.71177 2.05294 2.45294 2.34706C2.19412 2.64118 1.99412 2.97647 1.85294 3.35294C1.72353 3.72941 1.65882 4.11176 1.65882 4.5C1.65882 4.74706 1.68235 4.99412 1.72941 5.24118C1.78824 5.47647 1.87059 5.70588 1.97647 5.92941ZM4.5 7.60588C4.88824 7.60588 5.25882 7.52353 5.61176 7.35882C5.97647 7.18235 6.28824 6.94706 6.54706 6.65294C6.80588 6.35882 7 6.02353 7.12941 5.64706C7.27059 5.27059 7.34118 4.88824 7.34118 4.5C7.34118 4.25294 7.31177 4.01177 7.25294 3.77647C7.20588 3.52941 7.12941 3.29412 7.02353 3.07059L2.96471 7.11177C3.18824 7.27647 3.42941 7.4 3.68824 7.48235C3.95882 7.56471 4.22941 7.60588 4.5 7.60588Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

-3
View File
@@ -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>

Before

Width:  |  Height:  |  Size: 1.0 KiB

+2 -2
View File
@@ -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