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
|
@ -173,6 +173,7 @@ enum EditorResponse {
|
|||
struct AppliedAction {
|
||||
source: String,
|
||||
buffer: Entity<language::Buffer>,
|
||||
edit_ids: Vec<clock::Lamport>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -340,9 +341,18 @@ impl EditToolRequest {
|
|||
self.push_search_error(error);
|
||||
}
|
||||
DiffResult::Diff(diff) => {
|
||||
let _clock = buffer.update(cx, |buffer, cx| 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())
|
||||
})?;
|
||||
|
||||
self.push_applied_action(AppliedAction { source, buffer });
|
||||
self.push_applied_action(AppliedAction {
|
||||
source,
|
||||
buffer,
|
||||
edit_ids,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,7 +474,10 @@ impl EditToolRequest {
|
|||
let mut changed_buffers = HashSet::default();
|
||||
|
||||
for action in applied {
|
||||
changed_buffers.insert(action.buffer);
|
||||
changed_buffers.insert(action.buffer.clone());
|
||||
self.action_log.update(cx, |log, cx| {
|
||||
log.buffer_edited(action.buffer, action.edit_ids, cx)
|
||||
})?;
|
||||
write!(&mut output, "\n\n{}", action.source)?;
|
||||
}
|
||||
|
||||
|
@ -474,10 +487,6 @@ impl EditToolRequest {
|
|||
.await?;
|
||||
}
|
||||
|
||||
self.action_log
|
||||
.update(cx, |log, cx| log.buffer_edited(changed_buffers.clone(), cx))
|
||||
.log_err();
|
||||
|
||||
if !search_errors.is_empty() {
|
||||
writeln!(
|
||||
&mut output,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue