mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
re-enabled quad-backticks, but allow triple-backticks as fences when searching for filenames #2879
This commit is contained in:
parent
3e71c35fdd
commit
0dde77009e
3 changed files with 9 additions and 3 deletions
|
@ -60,7 +60,7 @@ def wrap_fence(name):
|
||||||
|
|
||||||
all_fences = [
|
all_fences = [
|
||||||
("`" * 3, "`" * 3),
|
("`" * 3, "`" * 3),
|
||||||
# ("`" * 4, "`" * 4), # LLMs ignore and revert to triple-backtick, causing #2879
|
("`" * 4, "`" * 4), # LLMs ignore and revert to triple-backtick, causing #2879
|
||||||
wrap_fence("source"),
|
wrap_fence("source"),
|
||||||
wrap_fence("code"),
|
wrap_fence("code"),
|
||||||
wrap_fence("pre"),
|
wrap_fence("pre"),
|
||||||
|
|
|
@ -401,6 +401,9 @@ missing_filename_err = (
|
||||||
" {fence[0]}"
|
" {fence[0]}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Always be willing to treat triple-backticks as a fence when searching for filenames
|
||||||
|
triple_backticks = "`" * 3
|
||||||
|
|
||||||
|
|
||||||
def strip_filename(filename, fence):
|
def strip_filename(filename, fence):
|
||||||
filename = filename.strip()
|
filename = filename.strip()
|
||||||
|
@ -409,7 +412,7 @@ def strip_filename(filename, fence):
|
||||||
return
|
return
|
||||||
|
|
||||||
start_fence = fence[0]
|
start_fence = fence[0]
|
||||||
if filename.startswith(start_fence):
|
if filename.startswith(start_fence) or filename.startswith(triple_backticks):
|
||||||
return
|
return
|
||||||
|
|
||||||
filename = filename.rstrip(":")
|
filename = filename.rstrip(":")
|
||||||
|
@ -546,7 +549,7 @@ def find_filename(lines, fence, valid_fnames):
|
||||||
filenames.append(filename)
|
filenames.append(filename)
|
||||||
|
|
||||||
# Only continue as long as we keep seeing fences
|
# Only continue as long as we keep seeing fences
|
||||||
if not line.startswith(fence[0]):
|
if not line.startswith(fence[0]) and not line.startswith(triple_backticks):
|
||||||
break
|
break
|
||||||
|
|
||||||
if not filenames:
|
if not filenames:
|
||||||
|
|
|
@ -991,6 +991,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
analytics.event("exit", reason="Failed to read apply content")
|
analytics.event("exit", reason="Failed to read apply content")
|
||||||
return
|
return
|
||||||
coder.partial_response_content = content
|
coder.partial_response_content = content
|
||||||
|
# For testing #2879
|
||||||
|
# from aider.coders.base_coder import all_fences
|
||||||
|
# coder.fence = all_fences[1]
|
||||||
coder.apply_updates()
|
coder.apply_updates()
|
||||||
analytics.event("exit", reason="Applied updates")
|
analytics.event("exit", reason="Applied updates")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue