autosave: Respect project autosave settings per file (#13369)

This fixes #13316 by checking whether there are any local workspace
settings for a given file.

Release Notes:

- Fixed `autosave` settings in project-specific settings file being
ignored. ([#13316](https://github.com/zed-industries/zed/issues/13316)).

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-06-24 14:56:22 +02:00 committed by GitHub
parent 3ee3c6a3bd
commit 40748b0a15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 17 deletions

View file

@ -3502,11 +3502,11 @@ impl Workspace {
if let Some(item) = pane.active_item() {
item.workspace_deactivated(cx);
}
if matches!(
WorkspaceSettings::get_global(cx).autosave,
AutosaveSetting::OnWindowChange | AutosaveSetting::OnFocusChange
) {
for item in pane.items() {
for item in pane.items() {
if matches!(
item.workspace_settings(cx).autosave,
AutosaveSetting::OnWindowChange | AutosaveSetting::OnFocusChange
) {
Pane::autosave_item(item.as_ref(), self.project.clone(), cx)
.detach_and_log_err(cx);
}