From b7f9fd7d74e33778912e22a706236e622046a769 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Mon, 29 Sep 2025 17:45:23 +0200 Subject: [PATCH] zeta2: Do not include empty edit events (#39116) Release Notes: - N/A --- crates/zeta2/src/zeta2.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/crates/zeta2/src/zeta2.rs b/crates/zeta2/src/zeta2.rs index f58bb963dd4cb4d852bf24f2ee7cbb02abc6efa9..ba9b50bbf3f0ea51232f39a729b3bf0cdb92aaef 100644 --- a/crates/zeta2/src/zeta2.rs +++ b/crates/zeta2/src/zeta2.rs @@ -339,7 +339,7 @@ impl Zeta { state .events .iter() - .map(|event| match event { + .filter_map(|event| match event { Event::BufferChange { old_snapshot, new_snapshot, @@ -356,15 +356,20 @@ impl Zeta { } }); - 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, + // TODO [zeta2] move to bg? + let diff = + language::unified_diff(&old_snapshot.text(), &new_snapshot.text()); + + if path == old_path && diff.is_empty() { + None + } else { + Some(predict_edits_v3::Event::BufferChange { + old_path, + path, + diff, + //todo: Actually detect if this edit was predicted or not + predicted: false, + }) } } })