Accept finished inline transformations only if the user saves manually (#16112)
Closes https://github.com/zed-industries/zed/issues/16042 This commit modifies the behavior of inline transformations to only accept finished transformations when the user manually saves the file. Previously, transformations were automatically accepted on any save event, including autosaves. This was achieved by updating the `Pane` and `Workspace` structs to emit a new `UserSavedItem` event when a manual save occurs, and modifying the `InlineAssistant` to register and handle this new event (instead of `editor::Saved`). Release Notes: - N/A
This commit is contained in:
parent
48f6193628
commit
a15a9565ab
4 changed files with 74 additions and 14 deletions
|
@ -40,7 +40,7 @@ use gpui::{
|
|||
};
|
||||
use item::{
|
||||
FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, PreviewTabsSettings,
|
||||
ProjectItem, SerializableItem, SerializableItemHandle,
|
||||
ProjectItem, SerializableItem, SerializableItemHandle, WeakItemHandle,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{LanguageRegistry, Rope};
|
||||
|
@ -670,6 +670,11 @@ pub enum Event {
|
|||
ItemAdded,
|
||||
ItemRemoved,
|
||||
ActiveItemChanged,
|
||||
UserSavedItem {
|
||||
pane: WeakView<Pane>,
|
||||
item: Box<dyn WeakItemHandle>,
|
||||
save_intent: SaveIntent,
|
||||
},
|
||||
ContactRequestedJoin(u64),
|
||||
WorkspaceCreated(WeakView<Workspace>),
|
||||
SpawnTask(Box<SpawnInTerminal>),
|
||||
|
@ -2934,6 +2939,11 @@ impl Workspace {
|
|||
self.update_active_view_for_followers(cx);
|
||||
}
|
||||
}
|
||||
pane::Event::UserSavedItem { item, save_intent } => cx.emit(Event::UserSavedItem {
|
||||
pane: pane.downgrade(),
|
||||
item: item.boxed_clone(),
|
||||
save_intent: *save_intent,
|
||||
}),
|
||||
pane::Event::ChangeItemTitle => {
|
||||
if pane == self.active_pane {
|
||||
self.active_item_path_changed(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue