Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Avoid hanging waiting for operations when buffer has none
Antonio Scandurra344d05045d20
diff --git a/crates/project/src/project.rs b/crates/project/src/project.rsindex dfd7b4fbf11..ca1b988d059 100644--- a/crates/project/src/project.rs+++ b/crates/project/src/project.rs@@ -6255,16 +6255,19 @@ fn split_operations(#[cfg(not(any(test, feature = "test-support")))]const CHUNK_SIZE: usize = 100;+ let mut done = false;std::iter::from_fn(move || {- if operations.is_empty() {+ if done {return None;}- Some(- operations- .drain(..cmp::min(CHUNK_SIZE, operations.len()))- .collect(),- )+ let operations = operations+ .drain(..cmp::min(CHUNK_SIZE, operations.len()))+ .collect::<Vec<_>>();+ if operations.is_empty() {+ done = true;+ }+ Some(operations)})}