Fix dollar sign replacement bug in file editing (#7871)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
fuyou
2025-09-13 14:05:43 +08:00
committed by GitHub
parent 087c192e51
commit 73466b626d
8 changed files with 239 additions and 24 deletions
+4 -1
View File
@@ -33,6 +33,7 @@ import type {
ModifyContext,
} from './modifiable-tool.js';
import { IdeClient } from '../ide/ide-client.js';
import { safeLiteralReplace } from '../utils/textUtils.js';
export function applyReplacement(
currentContent: string | null,
@@ -51,7 +52,9 @@ export function applyReplacement(
if (oldString === '' && !isNewFile) {
return currentContent;
}
return currentContent.replaceAll(oldString, newString);
// Use intelligent replacement that handles $ sequences safely
return safeLiteralReplace(currentContent, oldString, newString);
}
/**