continue-custom/core/edit/searchAndReplace
Matt Van Horn 9c08e5917a
fix: preserve indentation when applying code edits to Python files (#11289)
* fix: preserve indentation when applying code edits via fuzzy matching

When fallback matching strategies (trimmedMatch, whitespaceIgnoredMatch)
find a match with different indentation than the LLM-provided old_string,
the replacement new_string now has its indentation adjusted to match the
actual indentation level in the file. This fixes incorrect indentation in
Python code edits where the LLM provides unindented search/replace strings
that match indented code blocks.

Fixes #11282

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(core): adjust indentation when fallback match strategies splice replacements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 13:12:00 -07:00
..
executeFindAndReplace.vitest.ts fix: preserve indentation when applying code edits to Python files (#11289) 2026-03-24 13:12:00 -07:00
findAndReplaceUtils.ts feat: tool call args preprocessing (#7992) 2025-09-30 18:49:29 -07:00
findAndReplaceUtils.vitest.ts feat: tool call args preprocessing (#7992) 2025-09-30 18:49:29 -07:00
findSearchMatch.ts fix: add case insensitive match strategy for find and replace 2025-12-02 18:52:09 +05:30
findSearchMatch.vitest.ts add tests 2025-12-02 18:52:24 +05:30
findSearchMatches.test.ts fix tests 2025-12-04 18:36:15 +05:30
multiEdit.vitest.ts feat: search and replace fallback reintroduction cont. 2025-09-20 02:41:25 -07:00
multiEditValidation.ts feat: tool call args preprocessing (#7992) 2025-09-30 18:49:29 -07:00
performReplace.ts fix: preserve indentation when applying code edits to Python files (#11289) 2026-03-24 13:12:00 -07:00
validateArgs.ts feat: tool call args preprocessing (#7992) 2025-09-30 18:49:29 -07:00