From e8aae6c1dd891f404aaaef9297caa9c412f1178c Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 16 Jun 2025 20:40:19 +0800 Subject: [PATCH] fix: copilot replace_in_file example (#2239) Co-authored-by: Andre-Philippe Paquet --- lua/avante/llm_tools/replace_in_file.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lua/avante/llm_tools/replace_in_file.lua b/lua/avante/llm_tools/replace_in_file.lua index 78e4124..e9340e9 100644 --- a/lua/avante/llm_tools/replace_in_file.lua +++ b/lua/avante/llm_tools/replace_in_file.lua @@ -40,6 +40,22 @@ One or more SEARCH/REPLACE blocks following this exact format: [new content to replace with] +++++++ REPLACE \`\`\` + +Example: + \`\`\` + ------- SEARCH + func my_function(param1, param2) { + // This is a comment + console.log(param1); + } + ======= + func my_function(param1, param2) { + // This is a modified comment + console.log(param2); + } + +++++++ REPLACE + \`\`\` + Critical rules: 1. SEARCH content must match the associated file section to find EXACTLY: * Do not refer to the `diff` argument of the previous `replace_in_file` function call for SEARCH content matching, as it may have been modified. Always match from the latest file content in or from the `view` function call result.