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.

Ensure `disable_ai` is properly respected (#34941)

Finn Evers2bc6e18ac913
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs
index 7e9360a0cbf..95ce2896083 100644
--- a/crates/agent_ui/src/agent_panel.rs
+++ b/crates/agent_ui/src/agent_panel.rs
@@ -1,5 +1,5 @@
use std::cell::RefCell;
-use std::ops::Range;
+use std::ops::{Not, Range};
use std::path::Path;
use std::rc::Rc;
use std::sync::Arc;
@@ -1666,10 +1666,7 @@ impl Panel for AgentPanel {
}
fn icon(&self, _window: &Window, cx: &App) -> Option<IconName> {
- (self.enabled(cx)
- && AgentSettings::get_global(cx).button
- && !DisableAiSettings::get_global(cx).disable_ai)
- .then_some(IconName::ZedAssistant)
+ (self.enabled(cx) && AgentSettings::get_global(cx).button).then_some(IconName::ZedAssistant)
}
fn icon_tooltip(&self, _window: &Window, _cx: &App) -> Option<&'static str> {
@@ -1685,7 +1682,7 @@ impl Panel for AgentPanel {
}
fn enabled(&self, cx: &App) -> bool {
- AgentSettings::get_global(cx).enabled
+ DisableAiSettings::get_global(cx).disable_ai.not() && AgentSettings::get_global(cx).enabled
}
fn is_zoomed(&self, _window: &Window, _cx: &App) -> bool {
diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs
index 3f047e2f114..7165de23ecf 100644
--- a/crates/workspace/src/dock.rs
+++ b/crates/workspace/src/dock.rs
@@ -374,12 +374,6 @@ impl Dock {
})
}
- pub fn first_enabled_panel_idx_excluding(&self, exclude_name: &str, cx: &App) -> Option<usize> {
- self.panel_entries.iter().position(|entry| {
- entry.panel.persistent_name() != exclude_name && entry.panel.enabled(cx)
- })
- }
-
fn active_panel_entry(&self) -> Option<&PanelEntry> {
self.active_panel_index
.and_then(|index| self.panel_entries.get(index))