Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zeta: Compute diff on background thread (#22328)
Piotr Osiewiczbc32b4d016b0
diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rsindex 78faf4883be..d227c0bcab9 100644--- a/crates/zeta/src/zeta.rs+++ b/crates/zeta/src/zeta.rs@@ -298,14 +298,21 @@ impl Zeta {cx.spawn(|this, mut cx| async move {let request_sent_at = Instant::now();- let mut input_events = String::new();- for event in events {- if !input_events.is_empty() {- input_events.push('\n');- input_events.push('\n');- }- input_events.push_str(&event.to_prompt());- }+ let input_events = cx+ .background_executor()+ .spawn(async move {+ let mut input_events = String::new();+ for event in events {+ if !input_events.is_empty() {+ input_events.push('\n');+ input_events.push('\n');+ }+ input_events.push_str(&event.to_prompt());+ }+ input_events+ })+ .await;+let input_excerpt = prompt_for_excerpt(&snapshot, &excerpt_range, offset);let input_outline = prompt_for_outline(&snapshot);