mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
Try replace_part_with_missing_leading_whitespace first, so that single line edits get the benefit
This commit is contained in:
parent
737394f9b6
commit
8d408e1fc4
1 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,7 @@ import re
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# from aider.dump import dump
|
from .dump import dump # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
def try_dotdotdots(whole, part, replace):
|
def try_dotdotdots(whole, part, replace):
|
||||||
|
@ -96,13 +96,13 @@ def replace_part_with_missing_leading_whitespace(whole, part, replace):
|
||||||
|
|
||||||
|
|
||||||
def replace_most_similar_chunk(whole, part, replace):
|
def replace_most_similar_chunk(whole, part, replace):
|
||||||
if part in whole:
|
|
||||||
return whole.replace(part, replace)
|
|
||||||
|
|
||||||
res = replace_part_with_missing_leading_whitespace(whole, part, replace)
|
res = replace_part_with_missing_leading_whitespace(whole, part, replace)
|
||||||
if res:
|
if res:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
if part in whole:
|
||||||
|
return whole.replace(part, replace)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = try_dotdotdots(whole, part, replace)
|
res = try_dotdotdots(whole, part, replace)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue