From c77cc9b0eb220af6162cf46deb7b944b7c5976a7 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Thu, 16 Oct 2025 17:13:17 +0200 Subject: [PATCH] Revert "acp: Don't collapse tool calls by default" (#40395) Reverts zed-industries/zed#40164 Release Notes: - N/A --- crates/agent_ui/src/acp/thread_view.rs | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index b43d7dd277e0a2ca4fbc8ecae2c4ba8a1ae90999..a5af5b2521894b2051e6edfbe8677aa86177f6f1 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -278,7 +278,7 @@ pub struct AcpThreadView { thread_feedback: ThreadFeedbackState, list_state: ListState, auth_task: Option>, - collapsed_tool_calls: HashSet, + expanded_tool_calls: HashSet, expanded_thinking_blocks: HashSet<(usize, usize)>, edits_expanded: bool, plan_expanded: bool, @@ -428,7 +428,7 @@ impl AcpThreadView { thread_error: None, thread_feedback: Default::default(), auth_task: None, - collapsed_tool_calls: HashSet::default(), + expanded_tool_calls: HashSet::default(), expanded_thinking_blocks: HashSet::default(), editing_message: None, edits_expanded: false, @@ -965,17 +965,17 @@ impl AcpThreadView { ) { match &event.view_event { ViewEvent::NewDiff(tool_call_id) => { - if !AgentSettings::get_global(cx).expand_edit_card { - self.collapsed_tool_calls.insert(tool_call_id.clone()); + if AgentSettings::get_global(cx).expand_edit_card { + self.expanded_tool_calls.insert(tool_call_id.clone()); } } ViewEvent::NewTerminal(tool_call_id) => { - if !AgentSettings::get_global(cx).expand_terminal_card { - self.collapsed_tool_calls.insert(tool_call_id.clone()); + if AgentSettings::get_global(cx).expand_terminal_card { + self.expanded_tool_calls.insert(tool_call_id.clone()); } } ViewEvent::TerminalMovedToBackground(tool_call_id) => { - self.collapsed_tool_calls.insert(tool_call_id.clone()); + self.expanded_tool_calls.remove(tool_call_id); } ViewEvent::MessageEditorEvent(_editor, MessageEditorEvent::Focus) => { if let Some(thread) = self.thread() @@ -2130,7 +2130,7 @@ impl AcpThreadView { let is_collapsible = !tool_call.content.is_empty() && !needs_confirmation; - let is_open = needs_confirmation || !self.collapsed_tool_calls.contains(&tool_call.id); + let is_open = needs_confirmation || self.expanded_tool_calls.contains(&tool_call.id); let tool_output_display = if is_open { @@ -2280,9 +2280,9 @@ impl AcpThreadView { let id = tool_call.id.clone(); move |this: &mut Self, _, _, cx: &mut Context| { if is_open { - this.collapsed_tool_calls.insert(id.clone()); + this.expanded_tool_calls.remove(&id); } else { - this.collapsed_tool_calls.remove(&id); + this.expanded_tool_calls.insert(id.clone()); } cx.notify(); } @@ -2484,7 +2484,7 @@ impl AcpThreadView { .icon_color(Color::Muted) .on_click(cx.listener({ move |this: &mut Self, _, _, cx: &mut Context| { - this.collapsed_tool_calls.insert(tool_call_id.clone()); + this.expanded_tool_calls.remove(&tool_call_id); cx.notify(); } })), @@ -2762,7 +2762,7 @@ impl AcpThreadView { .map(|path| path.display().to_string()) .unwrap_or_else(|| "current directory".to_string()); - let is_expanded = !self.collapsed_tool_calls.contains(&tool_call.id); + let is_expanded = self.expanded_tool_calls.contains(&tool_call.id); let header = h_flex() .id(header_id) @@ -2897,9 +2897,9 @@ impl AcpThreadView { let id = tool_call.id.clone(); move |this, _event, _window, _cx| { if is_expanded { - this.collapsed_tool_calls.insert(id.clone()); + this.expanded_tool_calls.remove(&id); } else { - this.collapsed_tool_calls.remove(&id); + this.expanded_tool_calls.insert(id.clone()); } } })),