Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Iterate on tools some more (#26663)
Antonio Scandurrae80df25386a3
diff --git a/crates/assistant_tools/src/bash_tool/description.md b/crates/assistant_tools/src/bash_tool/description.mdindex 666a7c28c03..9cb703fe385 100644--- a/crates/assistant_tools/src/bash_tool/description.md+++ b/crates/assistant_tools/src/bash_tool/description.md@@ -1,5 +1,7 @@Executes a bash one-liner and returns the combined output.-This tool spawns a bash process, combines stdout and stderr into one interleaved stream as they are produced (preserving the order of writes), and captures that stream into a string which is returned.+This tool spawns a bash process IN THE SPECIFIED WORKING DIRECTORY, combines stdout and stderr into one interleaved stream as they are produced (preserving the order of writes), and captures that stream into a string which is returned.++WARNING: **NEVER** use 'cd' commands to navigate to the working directory - this is automatically handled by the 'working_directory' parameter. Only use 'cd' to navigate to subdirectories within the specified working directory.Remember that each invocation of this tool will spawn a new bash process, so you can't rely on any state from previous invocations.diff --git a/crates/assistant_tools/src/edit_files_tool.rs b/crates/assistant_tools/src/edit_files_tool.rsindex ed222c00baa..2cb3f06f82f 100644--- a/crates/assistant_tools/src/edit_files_tool.rs+++ b/crates/assistant_tools/src/edit_files_tool.rs@@ -204,15 +204,27 @@ impl EditFilesTool {let diff = buffer.read_with(&cx, |buffer, cx| {let new_text = match action {- EditAction::Replace { old, new, .. } => {+ EditAction::Replace {+ file_path,+ old,+ new,+ } => {// TODO: Replace in background?- buffer.text().replace(&old, &new)+ let text = buffer.text();+ if text.contains(&old) {+ text.replace(&old, &new)+ } else {+ return Err(anyhow!(+ "Could not find search text in {}",+ file_path.display()+ ));+ }}EditAction::Write { content, .. } => content,};- buffer.diff(new_text, cx)- })?+ anyhow::Ok(buffer.diff(new_text, cx))+ })??.await;let _clock =