edit method
Replaces oldString with newString in path. When replaceAll is
false exactly one occurrence must match. When atLine is given, the match
must occur on that 1-based line or the edit is rejected.
Implementation
@override
Future<RepoEdit> edit(
String path,
String oldString,
String newString, {
bool replaceAll = false,
int? atLine,
}) async {
final p = normalizeRepoPath(path);
final content = _requireFile(p);
final result = applyEdit(
content,
oldString,
newString,
replaceAll: replaceAll,
atLine: atLine,
);
_files[p] = result.content;
return RepoEdit(
path: p,
replacements: result.replacements,
appliedAtLine: result.appliedAtLine,
);
}