Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

diagnostics: Respect toolbar breadcrumbs setting in diagnostics panel (#44974)

lif37bd27b2a8b2
diff --git a/crates/diagnostics/src/buffer_diagnostics.rs b/crates/diagnostics/src/buffer_diagnostics.rs
index 0fd8783dd51..ca28f2805ad 100644
--- a/crates/diagnostics/src/buffer_diagnostics.rs
+++ b/crates/diagnostics/src/buffer_diagnostics.rs
@@ -6,7 +6,7 @@ use crate::{
use anyhow::Result;
use collections::HashMap;
use editor::{
- Editor, EditorEvent, ExcerptRange, MultiBuffer, PathKey,
+ Editor, EditorEvent, EditorSettings, ExcerptRange, MultiBuffer, PathKey,
display_map::{BlockPlacement, BlockProperties, BlockStyle, CustomBlockId},
multibuffer_context_lines,
};
@@ -701,8 +701,12 @@ impl Item for BufferDiagnosticsEditor {
});
}
- fn breadcrumb_location(&self, _: &App) -> ToolbarItemLocation {
- ToolbarItemLocation::PrimaryLeft
+ fn breadcrumb_location(&self, cx: &App) -> ToolbarItemLocation {
+ if EditorSettings::get_global(cx).toolbar.breadcrumbs {
+ ToolbarItemLocation::PrimaryLeft
+ } else {
+ ToolbarItemLocation::Hidden
+ }
}
fn breadcrumbs(&self, theme: &theme::Theme, cx: &App) -> Option<Vec<BreadcrumbText>> {
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index 76edf4f9b43..0999bebdb6a 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -12,7 +12,7 @@ use buffer_diagnostics::BufferDiagnosticsEditor;
use collections::{BTreeSet, HashMap, HashSet};
use diagnostic_renderer::DiagnosticBlock;
use editor::{
- Editor, EditorEvent, ExcerptRange, MultiBuffer, PathKey,
+ Editor, EditorEvent, EditorSettings, ExcerptRange, MultiBuffer, PathKey,
display_map::{BlockPlacement, BlockProperties, BlockStyle, CustomBlockId},
multibuffer_context_lines,
};
@@ -894,8 +894,12 @@ impl Item for ProjectDiagnosticsEditor {
Some(Box::new(self.editor.clone()))
}
- fn breadcrumb_location(&self, _: &App) -> ToolbarItemLocation {
- ToolbarItemLocation::PrimaryLeft
+ fn breadcrumb_location(&self, cx: &App) -> ToolbarItemLocation {
+ if EditorSettings::get_global(cx).toolbar.breadcrumbs {
+ ToolbarItemLocation::PrimaryLeft
+ } else {
+ ToolbarItemLocation::Hidden
+ }
}
fn breadcrumbs(&self, theme: &theme::Theme, cx: &App) -> Option<Vec<BreadcrumbText>> {