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.

Add a button to remove the plan UI (#52360)

Mikayla Makib95542410ca1
diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs
index 2195f9e73ef..df59c67bb45 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>) {
+ 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 ad7efa94324..1ad07efd52d 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();