Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Ensure context meter updates when context is cleared (#30320)
Mani Rash Ahmadi51b25b5c223a
diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rsindex afa774168a3..094530129e1 100644--- a/crates/agent/src/active_thread.rs+++ b/crates/agent/src/active_thread.rs@@ -1481,7 +1481,7 @@ impl ActiveThread {_window: &mut Window,cx: &mut Context<Self>,) {- self.context_store.update(cx, |store, _cx| store.clear());+ self.context_store.update(cx, |store, cx| store.clear(cx));cx.notify();}diff --git a/crates/agent/src/context_store.rs b/crates/agent/src/context_store.rsindex dd5b42f596a..110db59864c 100644--- a/crates/agent/src/context_store.rs+++ b/crates/agent/src/context_store.rs@@ -58,9 +58,10 @@ impl ContextStore {self.context_set.iter().map(|entry| entry.as_ref())}- pub fn clear(&mut self) {+ pub fn clear(&mut self, cx: &mut Context<Self>) {self.context_set.clear();self.context_thread_ids.clear();+ cx.notify();}pub fn new_context_for_thread(diff --git a/crates/agent/src/inline_prompt_editor.rs b/crates/agent/src/inline_prompt_editor.rsindex b47f9ac01a8..c086541f2db 100644--- a/crates/agent/src/inline_prompt_editor.rs+++ b/crates/agent/src/inline_prompt_editor.rs@@ -371,7 +371,7 @@ impl<T: 'static> PromptEditor<T> {_window: &mut Window,cx: &mut Context<Self>,) {- self.context_store.update(cx, |store, _cx| store.clear());+ self.context_store.update(cx, |store, cx| store.clear(cx));cx.notify();}diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rsindex c4306baedf5..6d2d17b20c2 100644--- a/crates/agent/src/message_editor.rs+++ b/crates/agent/src/message_editor.rs@@ -279,7 +279,7 @@ impl MessageEditor {_window: &mut Window,cx: &mut Context<Self>,) {- self.context_store.update(cx, |store, _cx| store.clear());+ self.context_store.update(cx, |store, cx| store.clear(cx));cx.notify();}