mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
refactor: Decouple new_string correction from old_string
- Previously, `new_string` was assumed to be over-escaped if `old_string` was. - This change introduces an explicit check (`newStringPotentiallyEscaped`) to determine if `new_string` itself needs correction. - If `new_string` is potentially escaped, its corrected using an LLM call; otherwise, the original `new_string` is used. - This avoids unnecessary corrections to `new_string` when only `old_string` was problematic. Part of https://github.com/google-gemini/gemini-cli/issues/484
This commit is contained in:
committed by
N. Taylor Mullen
parent
24da7b3ca6
commit
ceb25c8350
@@ -78,7 +78,14 @@ export async function ensureCorrectEdit(
|
||||
|
||||
if (occurrences === 1) {
|
||||
finalOldString = unescapedOldStringAttempt;
|
||||
finalNewString = unescapeStringForGeminiBug(originalParams.new_string);
|
||||
if (newStringPotentiallyEscaped) {
|
||||
finalNewString = await correctNewString(
|
||||
client,
|
||||
originalParams.old_string, // original old
|
||||
unescapedOldStringAttempt, // corrected old
|
||||
originalParams.new_string, // original new (which is potentially escaped)
|
||||
);
|
||||
}
|
||||
} else if (occurrences === 0) {
|
||||
const llmCorrectedOldString = await correctOldStringMismatch(
|
||||
client,
|
||||
|
||||
Reference in New Issue
Block a user