From b95542410ca1afb6155a27e09d973c1bdcccabaa Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 25 Mar 2026 09:01:15 -0700 Subject: [PATCH] Add a button to remove the plan UI (#52360) ## Context This PR adds a button to remove the plan UI, if the user wants. ## Self-Review Checklist - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/acp_thread/src/acp_thread.rs | 5 +++++ crates/agent_ui/src/conversation_view/thread_view.rs | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 2195f9e73ef085bdbaf91aaec6e42383f533ee8f..df59c67bb4576e34f76539df34147fb4606bb9f3 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -2072,6 +2072,11 @@ impl AcpThread { cx.notify(); } + pub fn clear_plan(&mut self, cx: &mut Context) { + self.plan.entries.clear(); + cx.notify(); + } + #[cfg(any(test, feature = "test-support"))] pub fn send_raw( &mut self, diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs index ad7efa94324e910ed6f5bc63efe1cdf1b26bdc9e..1ad07efd52ddcffe29bd3d50e382d85813c3c994 100644 --- a/crates/agent_ui/src/conversation_view/thread_view.rs +++ b/crates/agent_ui/src/conversation_view/thread_view.rs @@ -2540,7 +2540,17 @@ impl ThreadView { this.border_b_1().border_color(cx.theme().colors().border) }) .child(Disclosure::new("plan_disclosure", plan_expanded)) - .child(title) + .child(title.flex_1()) + .child( + IconButton::new("dismiss-plan", IconName::Close) + .icon_size(IconSize::XSmall) + .shape(ui::IconButtonShape::Square) + .tooltip(Tooltip::text("Clear plan")) + .on_click(cx.listener(|this, _, _, cx| { + this.thread.update(cx, |thread, cx| thread.clear_plan(cx)); + cx.stop_propagation(); + })), + ) .on_click(cx.listener(|this, _, _, cx| { this.plan_expanded = !this.plan_expanded; cx.notify();