From a4b38fdb8fb11bab186292ecdd7850919f7503c9 Mon Sep 17 00:00:00 2001 From: Hannes Rudolph Date: Mon, 22 Dec 2025 22:43:26 -0700 Subject: [PATCH] fix: add recordToolUsage call after successful edit in EditFileAnthropicTool --- src/core/tools/EditFileAnthropicTool.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/tools/EditFileAnthropicTool.ts b/src/core/tools/EditFileAnthropicTool.ts index e015486cce..b0902a7f42 100644 --- a/src/core/tools/EditFileAnthropicTool.ts +++ b/src/core/tools/EditFileAnthropicTool.ts @@ -126,11 +126,11 @@ export class SearchAndReplaceTool extends BaseTool<"edit_file_anthropic"> { let newContent = fileContent const errors: string[] = [] - for (let i = 0; i < edits.length; i++) { - // Normalize line endings in search/replace strings to match file content - const old_text = edits[i].old_text.replace(/\r\n/g, "\n") - const new_text = edits[i].new_text.replace(/\r\n/g, "\n") - const searchPattern = new RegExp(escapeRegExp(old_text), "g") + for (let i = 0; i < edits.length; i++) { + // Normalize line endings in search/replace strings to match file content + const old_text = edits[i].old_text.replace(/\r\n/g, "\n") + const new_text = edits[i].new_text.replace(/\r\n/g, "\n") + const searchPattern = new RegExp(escapeRegExp(old_text), "g") const matchCount = newContent.match(searchPattern)?.length ?? 0 if (matchCount === 0) { @@ -245,6 +245,7 @@ export class SearchAndReplaceTool extends BaseTool<"edit_file_anthropic"> { } task.didEditFile = true + task.recordToolUsage("edit_file_anthropic") // Get the formatted response message const message = await task.diffViewProvider.pushToolWriteResult(task, task.cwd, false)