Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Save files when model uses rename tool (#57228)
Bennet Bo Fenner80d41375e556
diff --git a/crates/agent/src/tools/rename_tool.rs b/crates/agent/src/tools/rename_tool.rsindex ac8fa1dccb2..d05b9872b8c 100644--- a/crates/agent/src/tools/rename_tool.rs+++ b/crates/agent/src/tools/rename_tool.rs@@ -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,