diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rs index 952c924292d55e6edae84bf3dfd9391c5d6ccae9..80c3771085a46199c2b6ed4b4eacf77eace31408 100644 --- a/crates/ai/src/assistant.rs +++ b/crates/ai/src/assistant.rs @@ -341,6 +341,9 @@ impl AssistantPanel { this.pending_inline_assists.get(&inline_assist_id) { if pending_assist.transaction_id == Some(*tx_id) { + // Notice we are supplying `undo: false` here. This + // is because there's no need to undo the transaction + // because the user just did so. this.close_inline_assist( inline_assist_id, false, @@ -421,7 +424,7 @@ impl AssistantPanel { } } - fn close_inline_assist(&mut self, assist_id: usize, cancel: bool, cx: &mut ViewContext) { + fn close_inline_assist(&mut self, assist_id: usize, undo: bool, cx: &mut ViewContext) { self.hide_inline_assist(assist_id, cx); if let Some(pending_assist) = self.pending_inline_assists.remove(&assist_id) { @@ -438,7 +441,7 @@ impl AssistantPanel { if let Some(editor) = pending_assist.editor.upgrade(cx) { self.update_highlights_for_editor(&editor, cx); - if cancel { + if undo { if let Some(transaction_id) = pending_assist.transaction_id { editor.update(cx, |editor, cx| { editor.buffer().update(cx, |buffer, cx| {