mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
feat: Add support for optional multiline input tags with matching closing tag
This commit is contained in:
parent
16a4f823bd
commit
81696c2e7a
1 changed files with 18 additions and 3 deletions
21
aider/io.py
21
aider/io.py
|
@ -443,11 +443,26 @@ class InputOutput:
|
|||
|
||||
if line and line[0] == "{" and not multiline_input:
|
||||
multiline_input = True
|
||||
inp += line[1:] + "\n"
|
||||
# Check for optional tag after opening {
|
||||
if len(line) > 1:
|
||||
tag = ''.join(c for c in line[1:] if c.isalnum())
|
||||
multiline_tag = tag
|
||||
inp += line[len(tag)+1:] + "\n"
|
||||
else:
|
||||
multiline_tag = None
|
||||
inp += line[1:] + "\n"
|
||||
continue
|
||||
elif line and line[-1] == "}" and multiline_input:
|
||||
inp += line[:-1] + "\n"
|
||||
break
|
||||
if multiline_tag:
|
||||
# Check if the line ends with tag}
|
||||
if line.endswith(f"{multiline_tag}}"):
|
||||
inp += line[:-len(multiline_tag)-1] + "\n"
|
||||
break
|
||||
else:
|
||||
inp += line + "\n"
|
||||
else:
|
||||
inp += line[:-1] + "\n"
|
||||
break
|
||||
elif multiline_input:
|
||||
inp += line + "\n"
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue