Restore file to original content when rejecting file recreated by agent (#29264)
Release Notes: - Fixed a bug that could sometimes cause a file to be deleted when rejecting an agent change.
This commit is contained in:
parent
5e31d86f1f
commit
55ea481707
11 changed files with 77 additions and 63 deletions
|
@ -112,9 +112,12 @@ impl Tool for CreateFileTool {
|
|||
.await
|
||||
.map_err(|err| anyhow!("Unable to open buffer for {destination_path}: {err}"))?;
|
||||
cx.update(|cx| {
|
||||
action_log.update(cx, |action_log, cx| {
|
||||
action_log.track_buffer(buffer.clone(), cx)
|
||||
});
|
||||
buffer.update(cx, |buffer, cx| buffer.set_text(contents, cx));
|
||||
action_log.update(cx, |action_log, cx| {
|
||||
action_log.will_create_buffer(buffer.clone(), cx)
|
||||
action_log.buffer_edited(buffer.clone(), cx)
|
||||
});
|
||||
})?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue