Use entry_id on File instead of worktree::Diff to detect when buffers' files change
Rather than computing a diff after processing a batch of FSEvents, we instead detect renames as we're inserting entries. We store an entry_id on the File object that is owned by each buffer, and use this to detect when the path of the File has changed. We now also manage all File-related state and event emission for Buffers in the LocalWorktree, since the logic will need to be totally different in the remote case. Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
co-authored by
Max Brunsfeld
Antonio Scandurra
parent
e80439daaa
commit
34963ac80d
+5
-5
@@ -1,4 +1,4 @@
|
||||
mod buffer;
|
||||
pub mod buffer;
|
||||
pub mod display_map;
|
||||
mod element;
|
||||
pub mod movement;
|
||||
@@ -2007,9 +2007,9 @@ impl Editor {
|
||||
}
|
||||
|
||||
fn start_transaction(&self, cx: &mut ViewContext<Self>) {
|
||||
self.buffer.update(cx, |buffer, cx| {
|
||||
self.buffer.update(cx, |buffer, _| {
|
||||
buffer
|
||||
.start_transaction(Some(self.selection_set_id), cx)
|
||||
.start_transaction(Some(self.selection_set_id))
|
||||
.unwrap()
|
||||
});
|
||||
}
|
||||
@@ -2521,11 +2521,11 @@ impl workspace::ItemView for Editor {
|
||||
}
|
||||
|
||||
fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
self.buffer.read(cx).is_dirty(cx)
|
||||
self.buffer.read(cx).is_dirty()
|
||||
}
|
||||
|
||||
fn has_conflict(&self, cx: &AppContext) -> bool {
|
||||
self.buffer.read(cx).has_conflict(cx)
|
||||
self.buffer.read(cx).has_conflict()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user