mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
make line numbers optional
This commit is contained in:
parent
7c807c8c53
commit
07da14d3c7
1 changed files with 5 additions and 2 deletions
|
@ -114,14 +114,17 @@ def replace_most_similar_chunk(whole, part, replace):
|
||||||
return modified_whole
|
return modified_whole
|
||||||
|
|
||||||
|
|
||||||
def quoted_file(fname, display_fname):
|
def quoted_file(fname, display_fname, number=False):
|
||||||
prompt = "\n"
|
prompt = "\n"
|
||||||
prompt += display_fname
|
prompt += display_fname
|
||||||
prompt += "\n```\n"
|
prompt += "\n```\n"
|
||||||
file_content = Path(fname).read_text()
|
file_content = Path(fname).read_text()
|
||||||
lines = file_content.splitlines()
|
lines = file_content.splitlines()
|
||||||
for i, line in enumerate(lines, start=1):
|
for i, line in enumerate(lines, start=1):
|
||||||
prompt += f"{i:3d} {line}\n"
|
if number:
|
||||||
|
prompt += f"{i:4d} "
|
||||||
|
prompt += line + "\n"
|
||||||
|
|
||||||
prompt += "```\n"
|
prompt += "```\n"
|
||||||
return prompt
|
return prompt
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue