mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
added self.fence_ticks
This commit is contained in:
parent
59d99835b1
commit
f625d52bec
2 changed files with 6 additions and 4 deletions
|
@ -364,7 +364,7 @@ class Coder:
|
||||||
explain = f"""
|
explain = f"""
|
||||||
You *MUST* use {num_ticks} backticks, because some files contain {num_ticks-1} backticks already!"""
|
You *MUST* use {num_ticks} backticks, because some files contain {num_ticks-1} backticks already!"""
|
||||||
|
|
||||||
fence = "`" * num_ticks
|
self.fence_ticks = "`" * num_ticks
|
||||||
|
|
||||||
number_mapping = {
|
number_mapping = {
|
||||||
3: "triple",
|
3: "triple",
|
||||||
|
@ -375,7 +375,7 @@ You *MUST* use {num_ticks} backticks, because some files contain {num_ticks-1} b
|
||||||
|
|
||||||
prompt = prompt.format(
|
prompt = prompt.format(
|
||||||
num_ticks=num_ticks_name,
|
num_ticks=num_ticks_name,
|
||||||
fence=fence,
|
fence=self.fence_ticks,
|
||||||
num_ticks_explanation=explain,
|
num_ticks_explanation=explain,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class WholeFileCoder(Coder):
|
||||||
fname = None
|
fname = None
|
||||||
new_lines = []
|
new_lines = []
|
||||||
for i, line in enumerate(lines):
|
for i, line in enumerate(lines):
|
||||||
if line.startswith("```"):
|
if line.startswith(self.fence_ticks):
|
||||||
if fname is not None:
|
if fname is not None:
|
||||||
# ending an existing block
|
# ending an existing block
|
||||||
saw_fname = None
|
saw_fname = None
|
||||||
|
@ -77,7 +77,9 @@ class WholeFileCoder(Coder):
|
||||||
fname = chat_files[0]
|
fname = chat_files[0]
|
||||||
else:
|
else:
|
||||||
# TODO: sense which file it is by diff size
|
# TODO: sense which file it is by diff size
|
||||||
raise ValueError("No filename provided before ``` in file listing")
|
raise ValueError(
|
||||||
|
f"No filename provided before {self.fence_ticks} in file listing"
|
||||||
|
)
|
||||||
|
|
||||||
elif fname is not None:
|
elif fname is not None:
|
||||||
new_lines.append(line)
|
new_lines.append(line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue