From cefb63936d3f659fced09799cb298fba39f41eed Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 25 Jan 2022 15:33:49 -0800 Subject: [PATCH] Tweak diagnostic header styling Co-Authored-By: Nathan Sobo --- crates/diagnostics/src/diagnostics.rs | 3 ++- crates/editor/src/display_map/block_map.rs | 2 ++ crates/editor/src/element.rs | 1 + crates/editor/src/items.rs | 2 ++ crates/theme/src/theme.rs | 4 +--- crates/zed/assets/themes/_base.toml | 4 ++-- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 1099330f6e..ea5441b01e 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -745,7 +745,7 @@ fn diagnostic_header_renderer( })) .contained() .with_style(style.container) - .with_padding_left(cx.gutter_width - cx.gutter_padding - icon_width) + .with_padding_left(cx.gutter_padding) .expanded() .named("diagnostic header") }) @@ -1254,6 +1254,7 @@ mod tests { anchor_x: 0., gutter_padding: 0., gutter_width: 0., + line_height: 0., em_width: 0., }) .name() diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index fa39e07f13..5f3c8dc83e 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -72,6 +72,7 @@ pub struct BlockContext<'a> { pub gutter_width: f32, pub gutter_padding: f32, pub em_width: f32, + pub line_height: f32, } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] @@ -951,6 +952,7 @@ mod tests { anchor_x: 0., gutter_padding: 0., gutter_width: 0., + line_height: 0., em_width: 0., }) .name() diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index b4175658c8..7102c546f5 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -617,6 +617,7 @@ impl EditorElement { cx, anchor_x, gutter_padding, + line_height, gutter_width, em_width, }); diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index 3e05fcff43..1dafec32c6 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -334,6 +334,8 @@ impl View for DiagnosticMessage { diagnostic.message.lines().next().unwrap().to_string(), theme.diagnostic_message.clone(), ) + .contained() + .with_margin_left(theme.item_spacing) .boxed() } else { Empty::new().boxed() diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 497e9f9458..c3d37b950c 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -109,10 +109,8 @@ pub struct StatusBar { #[serde(flatten)] pub container: ContainerStyle, pub height: f32, + pub item_spacing: f32, pub cursor_position: TextStyle, - pub diagnostic_icon_size: f32, - pub diagnostic_icon_spacing: f32, - pub diagnostic_icon_color: Color, pub diagnostic_message: TextStyle, } diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index ddd4d60110..3e3f15919e 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -252,13 +252,13 @@ guest_selections = "$selection.guests" error_color = "$status.bad" [editor.diagnostic_path_header] +background = "$state.active_line" filename = { extends = "$text.0", size = 14 } path = { extends = "$text.2", size = 14, margin.left = 12 } text_scale_factor = 0.857 [editor.diagnostic_header] -background = "$state.active_line" -border = { width = 1, top = true, bottom = true, color = "$border.0" } +border = { width = 1, top = true, bottom = true, color = "#ffffff1c" } code = { extends = "$text.2", size = 14, margin.left = 10 } icon_width_factor = 1.5 text_scale_factor = 0.857