Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Adjust diagnostic in tabs behavior (#21671)
Danilo Lealeb3d3eaebfdc
diff --git a/assets/settings/default.json b/assets/settings/default.jsonindex dd9098e0c03..20819529ff6 100644--- a/assets/settings/default.json+++ b/assets/settings/default.json@@ -569,7 +569,8 @@// "Neighbour""activate_on_close": "history",/// Which files containing diagnostic errors/warnings to mark in the tabs.- /// This setting can take the following three values:+ /// Diagnostics are only shown when file icons are also active.+ /// This setting only works when can take the following three values:////// 1. Do not mark any files:/// "off"@@ -577,7 +578,7 @@/// "errors"/// 3. Mark files with errors and warnings:/// "all"- "show_diagnostics": "all"+ "show_diagnostics": "off"},// Settings related to preview tabs."preview_tabs": {diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rsindex 97c27b52a19..7b9478a9a73 100644--- a/crates/workspace/src/item.rs+++ b/crates/workspace/src/item.rs@@ -64,9 +64,9 @@ pub enum ClosePosition {#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]#[serde(rename_all = "snake_case")]pub enum ShowDiagnostics {+ #[default]Off,Errors,- #[default]All,}@@ -99,7 +99,7 @@ pub struct ItemSettingsContent {/// Which files containing diagnostic errors/warnings to mark in the tabs./// This setting can take the following three values:///- /// Default: all+ /// Default: offshow_diagnostics: Option<ShowDiagnostics>,/// Whether to always show the close button on tabs.///diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex d213ab630b9..a4ca58c11c3 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -2002,12 +2002,8 @@ impl Pane {let icon = if decorated_icon.is_none() {match item_diagnostic {- Some(&DiagnosticSeverity::ERROR) => {- Some(Icon::new(IconName::X).color(Color::Error))- }- Some(&DiagnosticSeverity::WARNING) => {- Some(Icon::new(IconName::Triangle).color(Color::Warning))- }+ Some(&DiagnosticSeverity::ERROR) => None,+ Some(&DiagnosticSeverity::WARNING) => None,_ => item.tab_icon(cx).map(|icon| icon.color(Color::Muted)),}.map(|icon| icon.size(IconSize::Small))@@ -2144,13 +2140,17 @@ impl Pane {.child(h_flex().gap_1()- .child(if let Some(decorated_icon) = decorated_icon {- div().child(decorated_icon.into_any_element())- } else if let Some(icon) = icon {- div().mt(px(2.5)).child(icon.into_any_element())- } else {- div()- })+ .items_center()+ .children(+ std::iter::once(if let Some(decorated_icon) = decorated_icon {+ Some(div().child(decorated_icon.into_any_element()))+ } else if let Some(icon) = icon {+ Some(div().child(icon.into_any_element()))+ } else {+ None+ })+ .flatten(),+ ).child(label),);