Autosave files on close, when setting is afterDelay (#36929)

Closes https://github.com/zed-industries/zed/issues/12149
Closes #35524

Release Notes:

- Improved autosave behavior, to prevent a confirmation dialog when
quickly closing files and using the `afterDelay` setting

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
itsaphel
2025-09-17 13:08:29 +00:00
committed by GitHub
co-authored by MrSubidubi
parent 86834887da
commit c54e294965
5 changed files with 49 additions and 14 deletions
@@ -254,6 +254,17 @@ pub enum AutosaveSetting {
OnWindowChange,
}
impl AutosaveSetting {
pub fn should_save_on_close(&self) -> bool {
matches!(
&self,
AutosaveSetting::OnFocusChange
| AutosaveSetting::OnWindowChange
| AutosaveSetting::AfterDelay { .. }
)
}
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum PaneSplitDirectionHorizontal {