From 985397b55c45b2d1c6985a37453901ca81a8a454 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 24 Aug 2023 09:52:07 +0200 Subject: [PATCH] :memo: --- crates/ai/src/refactor.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ai/src/refactor.rs b/crates/ai/src/refactor.rs index f668f8d5ac..2821a1e845 100644 --- a/crates/ai/src/refactor.rs +++ b/crates/ai/src/refactor.rs @@ -91,6 +91,7 @@ impl RefactoringAssistant { let mut highlights = Vec::new(); editor.buffer().update(cx, |buffer, cx| { + // Avoid grouping assistant edits with user edits. buffer.finalize_last_transaction(cx); buffer.start_transaction(cx); @@ -121,6 +122,7 @@ impl RefactoringAssistant { ); if let Some(transaction) = buffer.end_transaction(cx) { if let Some(first_transaction) = first_transaction { + // Group all assistant edits into the first transaction. buffer.merge_transaction_into( transaction, first_transaction, @@ -128,8 +130,8 @@ impl RefactoringAssistant { ); } else { first_transaction = Some(transaction); + buffer.finalize_last_transaction(cx); } - buffer.finalize_last_transaction(cx); } });