Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zeta2: Include edit events in cloud request (#38724)
Bennet Bo Fenner8fefd793f0c0
diff --git a/crates/zeta2/src/zeta2.rs b/crates/zeta2/src/zeta2.rsindex 4ecc0fa3acf..15917349366 100644--- a/crates/zeta2/src/zeta2.rs+++ b/crates/zeta2/src/zeta2.rs@@ -305,6 +305,44 @@ impl Zeta {.collect::<Vec<_>>();let debug_tx = self.debug_tx.clone();+ let events = project_state+ .map(|state| {+ state+ .events+ .iter()+ .map(|event| match event {+ Event::BufferChange {+ old_snapshot,+ new_snapshot,+ ..+ } => {+ let path = new_snapshot.file().map(|f| f.path().to_path_buf());++ let old_path = old_snapshot.file().and_then(|f| {+ let old_path = f.path().as_ref();+ if Some(old_path) != path.as_deref() {+ Some(old_path.to_path_buf())+ } else {+ None+ }+ });++ predict_edits_v3::Event::BufferChange {+ old_path,+ path,+ diff: language::unified_diff(+ &old_snapshot.text(),+ &new_snapshot.text(),+ ),+ //todo: Actually detect if this edit was predicted or not+ predicted: false,+ }+ }+ })+ .collect::<Vec<_>>()+ })+ .unwrap_or_default();+let request_task = cx.background_spawn({let snapshot = snapshot.clone();let buffer = buffer.clone();@@ -337,8 +375,8 @@ impl Zeta {let request = make_cloud_request(excerpt_path.clone(),context,- // TODO pass everything- Vec::new(),+ events,+ // TODO data collectionfalse,Vec::new(),None,