fix(replace_in_file): added a replace substring logic (#2438)
This commit is contained in:
@@ -102,6 +102,10 @@ M.returns = {
|
|||||||
---@param diff string
|
---@param diff string
|
||||||
---@return string
|
---@return string
|
||||||
local function fix_diff(diff)
|
local function fix_diff(diff)
|
||||||
|
-- Normalize block headers to the expected ones (fix for some LLMs output)
|
||||||
|
diff = diff:gsub("<<<<<<<%s*SEARCH", "------- SEARCH")
|
||||||
|
diff = diff:gsub(">>>>>>>%s*REPLACE", "+++++++ REPLACE")
|
||||||
|
|
||||||
local has_search_line = diff:match("^%s*-------* SEARCH") ~= nil
|
local has_search_line = diff:match("^%s*-------* SEARCH") ~= nil
|
||||||
if has_search_line then return diff end
|
if has_search_line then return diff end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user