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.

Improve prompt caching for edit prediction (#23061)

Antonio Scandurraf2ab00cec754
diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs
index 546f6a25490..9c794dc7fc6 100644
--- a/crates/zeta/src/zeta.rs
+++ b/crates/zeta/src/zeta.rs
@@ -206,7 +206,7 @@ impl Zeta {
}
fn push_event(&mut self, event: Event) {
- const MAX_EVENT_COUNT: usize = 20;
+ const MAX_EVENT_COUNT: usize = 16;
if let Some(Event::BufferChange {
new_snapshot: last_new_snapshot,
@@ -232,8 +232,8 @@ impl Zeta {
}
self.events.push_back(event);
- if self.events.len() > MAX_EVENT_COUNT {
- self.events.pop_front();
+ if self.events.len() >= MAX_EVENT_COUNT {
+ self.events.drain(..MAX_EVENT_COUNT / 2);
}
}