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
|
@ -4,8 +4,8 @@ use crate::{
|
|||
WorkspaceItemBuilder,
|
||||
item::{
|
||||
ActivateOnClose, ClosePosition, Item, ItemHandle, ItemSettings, PreviewTabsSettings,
|
||||
ProjectItemKind, ShowCloseButton, ShowDiagnostics, TabContentParams, TabTooltipContent,
|
||||
WeakItemHandle,
|
||||
ProjectItemKind, SaveOptions, ShowCloseButton, ShowDiagnostics, TabContentParams,
|
||||
TabTooltipContent, WeakItemHandle,
|
||||
},
|
||||
move_item,
|
||||
notifications::NotifyResultExt,
|
||||
|
@ -1870,7 +1870,15 @@ impl Pane {
|
|||
match answer.await {
|
||||
Ok(0) => {
|
||||
pane.update_in(cx, |_, window, cx| {
|
||||
item.save(should_format, project, window, cx)
|
||||
item.save(
|
||||
SaveOptions {
|
||||
format: should_format,
|
||||
autosave: false,
|
||||
},
|
||||
project,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.await?
|
||||
}
|
||||
|
@ -1896,7 +1904,15 @@ impl Pane {
|
|||
match answer.await {
|
||||
Ok(0) => {
|
||||
pane.update_in(cx, |_, window, cx| {
|
||||
item.save(should_format, project, window, cx)
|
||||
item.save(
|
||||
SaveOptions {
|
||||
format: should_format,
|
||||
autosave: false,
|
||||
},
|
||||
project,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.await?
|
||||
}
|
||||
|
@ -1967,7 +1983,15 @@ impl Pane {
|
|||
if pane.is_active_preview_item(item.item_id()) {
|
||||
pane.set_preview_item_id(None, cx);
|
||||
}
|
||||
item.save(should_format, project, window, cx)
|
||||
item.save(
|
||||
SaveOptions {
|
||||
format: should_format,
|
||||
autosave: false,
|
||||
},
|
||||
project,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.await?;
|
||||
} else if can_save_as && is_singleton {
|
||||
|
@ -2044,7 +2068,15 @@ impl Pane {
|
|||
AutosaveSetting::AfterDelay { .. }
|
||||
);
|
||||
if item.can_autosave(cx) {
|
||||
item.save(format, project, window, cx)
|
||||
item.save(
|
||||
SaveOptions {
|
||||
format,
|
||||
autosave: true,
|
||||
},
|
||||
project,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
} else {
|
||||
Task::ready(Ok(()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue