From 9ccf2f3f58d06fe2f18418949db6751b129c43a3 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 11 Jan 2022 15:17:18 -0800 Subject: [PATCH] Tweak theming of project diagnostics --- 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(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index adfc82105cefb2e07b52afc2249272fa3a5e9766..905cc39347504e4dfd6b00327039c706a36f0425 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -602,10 +602,14 @@ fn path_header_renderer(buffer: ModelHandle, 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() diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 55affde95ddda93c5b4cea5097ea6ab9970cc9cc..eb412f3dcb5343c8548a7d7a6228756713959c91 100644 --- a/crates/editor/src/editor.rs +++ b/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(), diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index dcd378dcc5b552e24e360f3ad77f1a350d930fed..3bd78f26342604792072b4946c668264ef323bdc 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -251,6 +251,7 @@ pub struct EditorStyle { pub line_number_active: Color, pub guest_selections: Vec, pub syntax: Arc, + 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(), diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index e85638c225824ffc5fc18dc9dcff83b671b311c9..95dc7eee606646aa8af18046214681b8ffad739e 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/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"