Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Show which lines were read when using `read_file` tool (#28077)
Bennet Bo Fenner9e38c45a9bc0
diff --git a/crates/assistant_tools/src/read_file_tool.rs b/crates/assistant_tools/src/read_file_tool.rsindex 17d7803d79f..b78d8d82d6b 100644--- a/crates/assistant_tools/src/read_file_tool.rs+++ b/crates/assistant_tools/src/read_file_tool.rs@@ -67,7 +67,11 @@ impl Tool for ReadFileTool {match serde_json::from_value::<ReadFileToolInput>(input.clone()) {Ok(input) => {let path = MarkdownString::inline_code(&input.path.display().to_string());- format!("Read file {path}")+ match (input.start_line, input.end_line) {+ (Some(start), None) => format!("Read file {path} (from line {start})"),+ (Some(start), Some(end)) => format!("Read file {path} (lines {start}-{end})"),+ _ => format!("Read file {path}"),+ }}Err(_) => "Read file".to_string(),}