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
|
@ -41,7 +41,7 @@ use util::{ResultExt as _, paths::PathMatcher};
|
|||
use workspace::{
|
||||
DeploySearch, ItemNavHistory, NewSearch, ToolbarItemEvent, ToolbarItemLocation,
|
||||
ToolbarItemView, Workspace, WorkspaceId,
|
||||
item::{BreadcrumbText, Item, ItemEvent, ItemHandle},
|
||||
item::{BreadcrumbText, Item, ItemEvent, ItemHandle, SaveOptions},
|
||||
searchable::{Direction, SearchableItem, SearchableItemHandle},
|
||||
};
|
||||
|
||||
|
@ -530,13 +530,13 @@ impl Item for ProjectSearchView {
|
|||
|
||||
fn save(
|
||||
&mut self,
|
||||
format: bool,
|
||||
options: SaveOptions,
|
||||
project: Entity<Project>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<anyhow::Result<()>> {
|
||||
self.results_editor
|
||||
.update(cx, |editor, cx| editor.save(format, project, window, cx))
|
||||
.update(cx, |editor, cx| editor.save(options, project, window, cx))
|
||||
}
|
||||
|
||||
fn save_as(
|
||||
|
@ -1086,9 +1086,19 @@ impl ProjectSearchView {
|
|||
let result = result_channel.await?;
|
||||
let should_save = result == 0;
|
||||
if should_save {
|
||||
this.update_in(cx, |this, window, cx| this.save(true, project, window, cx))?
|
||||
.await
|
||||
.log_err();
|
||||
this.update_in(cx, |this, window, cx| {
|
||||
this.save(
|
||||
SaveOptions {
|
||||
format: true,
|
||||
autosave: false,
|
||||
},
|
||||
project,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.await
|
||||
.log_err();
|
||||
}
|
||||
let should_search = result != 2;
|
||||
should_search
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue