Tweak diagnostic header styling

Max Brunsfeld and Nathan Sobo created

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

Change summary

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(-)

Detailed changes

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()

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()

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()

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,
 }
 

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