Tweak theming of project diagnostics

Max Brunsfeld created

Change summary

crates/diagnostics/src/diagnostics.rs |  6 +++++-
crates/editor/src/editor.rs           |  1 +
crates/theme/src/theme.rs             |  2 ++
crates/zed/assets/themes/_base.toml   | 13 +++++++++----
4 files changed, 17 insertions(+), 5 deletions(-)

Detailed changes

crates/diagnostics/src/diagnostics.rs 🔗

@@ -602,10 +602,14 @@ fn path_header_renderer(buffer: ModelHandle<Buffer>, build_settings: BuildSettin
         } else {
             "untitled".to_string()
         };
-        Label::new(file_path, settings.style.text.clone())
+        let mut text_style = settings.style.text.clone();
+        let style = settings.style.diagnostic_path_header;
+        text_style.color = style.text;
+        Label::new(file_path, text_style)
             .aligned()
             .left()
             .contained()
+            .with_style(style.header)
             .with_padding_left(cx.line_number_x)
             .expanded()
             .boxed()

crates/editor/src/editor.rs 🔗

@@ -3691,6 +3691,7 @@ impl EditorSettings {
                     selection: Default::default(),
                     guest_selections: Default::default(),
                     syntax: Default::default(),
+                    diagnostic_path_header: Default::default(),
                     error_diagnostic: Default::default(),
                     invalid_error_diagnostic: Default::default(),
                     warning_diagnostic: Default::default(),

crates/theme/src/theme.rs 🔗

@@ -251,6 +251,7 @@ pub struct EditorStyle {
     pub line_number_active: Color,
     pub guest_selections: Vec<SelectionStyle>,
     pub syntax: Arc<SyntaxTheme>,
+    pub diagnostic_path_header: DiagnosticStyle,
     pub error_diagnostic: DiagnosticStyle,
     pub invalid_error_diagnostic: DiagnosticStyle,
     pub warning_diagnostic: DiagnosticStyle,
@@ -316,6 +317,7 @@ impl InputEditorStyle {
             line_number_active: Default::default(),
             guest_selections: Default::default(),
             syntax: Default::default(),
+            diagnostic_path_header: Default::default(),
             error_diagnostic: Default::default(),
             invalid_error_diagnostic: Default::default(),
             warning_diagnostic: Default::default(),

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

@@ -256,21 +256,26 @@ invalid_warning_diagnostic = { text = "$text.3.color" }
 invalid_information_diagnostic = { text = "$text.3.color" }
 invalid_hint_diagnostic = { text = "$text.3.color" }
 
+[editor.diagnostic_path_header]
+text = "$text.0.color"
+header.background = "#ffffff08"
+header.border = { width = 1, top = true, color = "$border.0" }
+
 [editor.error_diagnostic]
 text = "$status.bad"
-header = { padding = { left = 10 }, background = "#ffffff08" }
+header.border = { width = 1, top = true, color = "$border.0" }
 
 [editor.warning_diagnostic]
 text = "$status.warn"
-header = { padding = { left = 10 }, background = "#ffffff08" }
+header.border = { width = 1, top = true, color = "$border.0" }
 
 [editor.information_diagnostic]
 text = "$status.info"
-header = { padding = { left = 10 }, background = "#ffffff08" }
+border = { width = 1, top = true, color = "$border.0" }
 
 [editor.hint_diagnostic]
 text = "$status.info"
-header = { padding = { left = 10 }, background = "#ffffff08" }
+border = { width = 1, top = true, color = "$border.0" }
 
 [project_diagnostics]
 background = "$surface.1"