Only send UpdateBufferFile messages for buffers whose files have changed

Send that message when saving a buffer as a new path.
This commit is contained in:
Max Brunsfeld 2023-02-20 09:33:02 -08:00
parent cdf64b6cad
commit 56b7eb6b6f
4 changed files with 43 additions and 36 deletions

View file

@ -4461,16 +4461,19 @@ impl Project {
renamed_buffers.push((cx.handle(), old_path));
}
if let Some(project_id) = self.remote_id() {
self.client
.send(proto::UpdateBufferFile {
project_id,
buffer_id: *buffer_id as u64,
file: Some(new_file.to_proto()),
})
.log_err();
if new_file != *old_file {
if let Some(project_id) = self.remote_id() {
self.client
.send(proto::UpdateBufferFile {
project_id,
buffer_id: *buffer_id as u64,
file: Some(new_file.to_proto()),
})
.log_err();
}
buffer.file_updated(Arc::new(new_file), cx).detach();
}
buffer.file_updated(Arc::new(new_file), cx).detach();
}
});
} else {
@ -6054,7 +6057,7 @@ impl Project {
.and_then(|buffer| buffer.upgrade(cx));
if let Some(buffer) = buffer {
buffer.update(cx, |buffer, cx| {
buffer.did_save(version, fingerprint, mtime, None, cx);
buffer.did_save(version, fingerprint, mtime, cx);
});
}
Ok(())