Don't autosave unmodified buffers (#32626)
Closes https://github.com/zed-industries/zed/issues/12091 Proper redo of https://github.com/zed-industries/zed/pull/32603 Release Notes: - Fixed formatting effects not triggered when saving unmodified singleton buffers --------- Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
parent
cd018da1ad
commit
cef0c415f6
17 changed files with 453 additions and 171 deletions
|
@ -37,7 +37,7 @@ use util::ResultExt as _;
|
|||
use workspace::{
|
||||
CloseActiveItem, ItemNavHistory, SerializableItem, ToolbarItemEvent, ToolbarItemLocation,
|
||||
ToolbarItemView, Workspace,
|
||||
item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams},
|
||||
item::{BreadcrumbText, Item, ItemEvent, ItemHandle, SaveOptions, TabContentParams},
|
||||
searchable::SearchableItemHandle,
|
||||
};
|
||||
|
||||
|
@ -632,12 +632,12 @@ impl Item for ProjectDiff {
|
|||
|
||||
fn save(
|
||||
&mut self,
|
||||
format: bool,
|
||||
options: SaveOptions,
|
||||
project: Entity<Project>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<()>> {
|
||||
self.editor.save(format, project, window, cx)
|
||||
self.editor.save(options, project, window, cx)
|
||||
}
|
||||
|
||||
fn save_as(
|
||||
|
@ -1565,7 +1565,15 @@ mod tests {
|
|||
|
||||
cx.update_window_entity(&buffer_editor, |buffer_editor, window, cx| {
|
||||
buffer_editor.set_text("different\n", window, cx);
|
||||
buffer_editor.save(false, project.clone(), window, cx)
|
||||
buffer_editor.save(
|
||||
SaveOptions {
|
||||
format: false,
|
||||
autosave: false,
|
||||
},
|
||||
project.clone(),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue