diff --git a/crates/theme/src/lib.rs b/crates/theme/src/lib.rs index 22d1dcd958..c4fbcc3031 100644 --- a/crates/theme/src/lib.rs +++ b/crates/theme/src/lib.rs @@ -95,10 +95,10 @@ pub struct StatusBar { pub container: ContainerStyle, pub height: f32, pub cursor_position: TextStyle, - pub diagnostic_error: TextStyle, - pub diagnostic_warning: TextStyle, - pub diagnostic_information: TextStyle, - pub diagnostic_hint: TextStyle, + pub diagnostic_icon_size: f32, + pub diagnostic_icon_spacing: f32, + pub diagnostic_icon_color: Color, + pub diagnostic_message: TextStyle, } #[derive(Deserialize, Default)] diff --git a/crates/workspace/src/items.rs b/crates/workspace/src/items.rs index 8a3ce6b5c8..61e2d65986 100644 --- a/crates/workspace/src/items.rs +++ b/crates/workspace/src/items.rs @@ -7,7 +7,7 @@ use gpui::{ elements::*, fonts::TextStyle, AppContext, Entity, ModelHandle, RenderContext, Subscription, Task, View, ViewContext, ViewHandle, }; -use language::{Buffer, Diagnostic, DiagnosticSeverity, File as _}; +use language::{Buffer, Diagnostic, File as _}; use postage::watch; use project::{ProjectPath, Worktree}; use std::fmt::Write; @@ -288,14 +288,24 @@ impl View for DiagnosticMessage { fn render(&mut self, _: &mut RenderContext) -> ElementBox { if let Some(diagnostic) = &self.diagnostic { let theme = &self.settings.borrow().theme.workspace.status_bar; - let style = match diagnostic.severity { - DiagnosticSeverity::ERROR => theme.diagnostic_error.clone(), - DiagnosticSeverity::WARNING => theme.diagnostic_warning.clone(), - DiagnosticSeverity::INFORMATION => theme.diagnostic_information.clone(), - DiagnosticSeverity::HINT => theme.diagnostic_hint.clone(), - _ => Default::default(), - }; - Label::new(diagnostic.message.replace('\n', " "), style).boxed() + 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.replace('\n', " "), + theme.diagnostic_message.clone(), + ) + .boxed(), + ) + .boxed() } else { Empty::new().boxed() } diff --git a/crates/zed/assets/icons/warning.svg b/crates/zed/assets/icons/warning.svg new file mode 100644 index 0000000000..09ebc28669 --- /dev/null +++ b/crates/zed/assets/icons/warning.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index 1697422a8d..77167df8b0 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -64,10 +64,10 @@ border = { width = 1, color = "$border.0", left = true } padding = { left = 6, right = 6 } height = 24 cursor_position = "$text.2" -diagnostic_error = { extends = "$text.2", color = "$status.bad" } -diagnostic_warning = { extends = "$text.2", color = "$status.warn" } -diagnostic_information = { extends = "$text.2", color = "$status.info" } -diagnostic_hint = { extends = "$text.2", color = "$status.info" } +diagnostic_message = "$text.2" +diagnostic_icon_size = 18 +diagnostic_icon_spacing = 8 +diagnostic_icon_color = "$text.2.color" [panel] padding = { top = 12, left = 12, bottom = 12, right = 12 } @@ -173,7 +173,7 @@ corner_radius = 6 [project_panel] extends = "$panel" -padding.top = 6 # ($workspace.tab.height - $project_panel.entry.height) / 2 +padding.top = 6 # ($workspace.tab.height - $project_panel.entry.height) / 2 [project_panel.entry] text = "$text.1"