mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-31 19:05:00 +07:00
agent: Save files when model uses rename tool (#57228)
Release Notes: - N/A
This commit is contained in:
parent
5656f3eb3f
commit
80d41375e5
1 changed files with 7 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ use std::fmt::Write;
|
|||
use std::sync::Arc;
|
||||
|
||||
use agent_client_protocol::schema as acp;
|
||||
use collections::HashSet;
|
||||
use gpui::{App, Entity, SharedString, Task};
|
||||
use project::Project;
|
||||
use schemars::JsonSchema;
|
||||
|
|
@ -95,6 +96,12 @@ impl AgentTool for RenameTool {
|
|||
));
|
||||
}
|
||||
|
||||
let buffers = transaction.0.keys().cloned().collect::<HashSet<_>>();
|
||||
project
|
||||
.update(cx, |project, cx| project.save_buffers(buffers, cx))
|
||||
.await
|
||||
.map_err(|e| format!("Rename succeeded, but failed to save renamed files: {e}"))?;
|
||||
|
||||
let mut output = format!(
|
||||
"Renamed `{}` to `{}` in {} file(s):\n",
|
||||
input.symbol.symbol_name,
|
||||
|
|
|
|||
Loading…
Reference in a new issue