Merge transactions into the original assistant transaction
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Kyle Caverly <kyle@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
Kyle Caverly
parent
a69461dba2
commit
301a12923f
@@ -85,7 +85,7 @@ impl RefactoringAssistant {
|
|||||||
anyhow::Ok(())
|
anyhow::Ok(())
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut last_transaction = None;
|
let mut first_transaction = None;
|
||||||
while let Some(hunks) = hunks_rx.next().await {
|
while let Some(hunks) = hunks_rx.next().await {
|
||||||
editor.update(&mut cx, |editor, cx| {
|
editor.update(&mut cx, |editor, cx| {
|
||||||
let mut highlights = Vec::new();
|
let mut highlights = Vec::new();
|
||||||
@@ -120,14 +120,15 @@ impl RefactoringAssistant {
|
|||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
if let Some(transaction) = buffer.end_transaction(cx) {
|
if let Some(transaction) = buffer.end_transaction(cx) {
|
||||||
if let Some(last_transaction) = last_transaction {
|
if let Some(first_transaction) = first_transaction {
|
||||||
buffer.merge_transaction_into(
|
buffer.merge_transaction_into(
|
||||||
last_transaction,
|
|
||||||
transaction,
|
transaction,
|
||||||
|
first_transaction,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
first_transaction = Some(transaction);
|
||||||
}
|
}
|
||||||
last_transaction = Some(transaction);
|
|
||||||
buffer.finalize_last_transaction(cx);
|
buffer.finalize_last_transaction(cx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user