| 1573 | return formatEditError(editCascadingEdit, "Cascading edit detected: old_string is a substring of a new_string from a previous edit on this file. Re-read the file and adjust the edit to target the original content.") |
| 1574 | } |
| 1575 | } |
| 1576 | return "" |
| 1577 | } |
| 1578 | |
| 1579 | func recordAppliedEdit(execCtx ExecutionContext, filePath, oldString, newString string) { |
| 1580 | raw, ok := execCtx["_applied_edits"].(map[string][]map[string]string) |
| 1581 | if !ok { |
| 1582 | raw = map[string][]map[string]string{} |
| 1583 | execCtx["_applied_edits"] = raw |
| 1584 | } |
| 1585 | raw[filePath] = append(raw[filePath], map[string]string{"old_string": oldString, "new_string": newString}) |
| 1586 | } |
| 1587 | |
| 1588 | func generateUnifiedDiff(path, oldContent, newContent string, contextLines int) string { |
| 1589 | if oldContent == newContent { |