Merge pull request #2187 from zed-industries/save-untitled-buffer-bugs

Fix newly-discovered bugs in saving untitled buffers
This commit is contained in:
Max Brunsfeld 2023-02-20 10:05:58 -08:00 committed by GitHub
commit 2982a98d1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 371 additions and 346 deletions

View file

@ -1,7 +1,6 @@
mod anchor;
pub use anchor::{Anchor, AnchorRangeExt};
use anyhow::Result;
use clock::ReplicaId;
use collections::{BTreeMap, Bound, HashMap, HashSet};
use futures::{channel::mpsc, SinkExt};
@ -1288,20 +1287,6 @@ impl MultiBuffer {
.map(|state| state.buffer.clone())
}
pub fn save(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
let mut save_tasks = Vec::new();
for BufferState { buffer, .. } in self.buffers.borrow().values() {
save_tasks.push(buffer.update(cx, |buffer, cx| buffer.save(cx)));
}
cx.spawn(|_, _| async move {
for save in save_tasks {
save.await?;
}
Ok(())
})
}
pub fn is_completion_trigger<T>(&self, position: T, text: &str, cx: &AppContext) -> bool
where
T: ToOffset,