Allow reviewing of agent changes without Git (#27668)
Release Notes: - N/A
This commit is contained in:
parent
8a307e7b89
commit
94ed0b7767
27 changed files with 2271 additions and 1095 deletions
|
@ -5,7 +5,7 @@ use language_model::LanguageModelRequestMessage;
|
|||
use project::Project;
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashSet, path::PathBuf, sync::Arc};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
use ui::IconName;
|
||||
|
||||
use crate::replace::replace_exact;
|
||||
|
@ -189,20 +189,21 @@ impl Tool for FindReplaceFileTool {
|
|||
.await;
|
||||
|
||||
if let Some(diff) = result {
|
||||
buffer.update(cx, |buffer, cx| {
|
||||
let _ = buffer.apply_diff(diff, cx);
|
||||
let edit_ids = buffer.update(cx, |buffer, cx| {
|
||||
buffer.finalize_last_transaction();
|
||||
buffer.apply_diff(diff, false, cx);
|
||||
let transaction = buffer.finalize_last_transaction();
|
||||
transaction.map_or(Vec::new(), |transaction| transaction.edit_ids.clone())
|
||||
})?;
|
||||
|
||||
action_log.update(cx, |log, cx| {
|
||||
log.buffer_edited(buffer.clone(), edit_ids, cx)
|
||||
})?;
|
||||
|
||||
project.update(cx, |project, cx| {
|
||||
project.save_buffer(buffer.clone(), cx)
|
||||
project.save_buffer(buffer, cx)
|
||||
})?.await?;
|
||||
|
||||
action_log.update(cx, |log, cx| {
|
||||
let mut buffers = HashSet::default();
|
||||
buffers.insert(buffer);
|
||||
log.buffer_edited(buffers, cx);
|
||||
})?;
|
||||
|
||||
Ok(format!("Edited {}", input.path.display()))
|
||||
} else {
|
||||
let err = buffer.read_with(cx, |buffer, _cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue