From 6ff6901421e6342289b3560577edd0af5fbe2131 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:06:51 +0100 Subject: [PATCH] fix: Remove check empty file for edit tool --- context/ChangesManager.cpp | 8 -------- tools/EditFileTool.cpp | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/context/ChangesManager.cpp b/context/ChangesManager.cpp index f6bbead..7659f16 100644 --- a/context/ChangesManager.cpp +++ b/context/ChangesManager.cpp @@ -701,14 +701,6 @@ bool ChangesManager::performFragmentReplacement( bool isUndo) { QString currentContent = readFileContent(filePath); - if (currentContent.isNull()) { - if (errorMsg) { - *errorMsg = "Failed to read current file content"; - } - LOG_MESSAGE(QString("Failed to read file for fragment replacement: %1").arg(filePath)); - return false; - } - QString resultContent; if (isAppendOperation) { diff --git a/tools/EditFileTool.cpp b/tools/EditFileTool.cpp index 663eb85..7ab0235 100644 --- a/tools/EditFileTool.cpp +++ b/tools/EditFileTool.cpp @@ -56,10 +56,11 @@ QString EditFileTool::description() const "and new_content to replace it with. Changes are applied immediately if auto-apply " "is enabled in settings. The user can undo or reapply changes at any time. " "\n\nIMPORTANT:" + "\n- For EMPTY files: use empty old_content (empty string or omit parameter)." + "\n- To append at the END of file: use empty old_content." "\n- To insert at the BEGINNING of a file (e.g., copyright header), you MUST provide " "the EXACT first few lines of the file as old_content (at least 3-5 lines), " "then put those lines + new header in new_content." - "\n- To append at the END of file, use empty old_content." "\n- For replacements in the middle, provide EXACT matching text with sufficient " "context (at least 5-10 lines) to ensure correct placement." "\n- The system requires 85% similarity for first-time edits. Provide accurate "