From b5a92896ab727f04e0952b3c108ddc13cd1bcfd2 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 22 Jun 2023 11:44:54 -0700 Subject: [PATCH] Move the fname inside the unified diff block --- aider/coders/wholefile_func_coder.py | 3 +-- aider/diffs.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aider/coders/wholefile_func_coder.py b/aider/coders/wholefile_func_coder.py index 8a0cd8f41..ecec9a440 100644 --- a/aider/coders/wholefile_func_coder.py +++ b/aider/coders/wholefile_func_coder.py @@ -78,8 +78,6 @@ class WholeFileFunctionCoder(Coder): if not content: continue - res += path + ":\n" - this_final = (i < len(files) - 1) or final res += self.live_diffs(path, content, this_final) @@ -98,6 +96,7 @@ class WholeFileFunctionCoder(Coder): orig_lines, lines, final, + fname=fname, ).splitlines() return "\n".join(show_diff) diff --git a/aider/diffs.py b/aider/diffs.py index dd6297d1b..7be231ce3 100644 --- a/aider/diffs.py +++ b/aider/diffs.py @@ -33,7 +33,7 @@ def create_progress_bar(percentage): return bar -def diff_partial_update(lines_orig, lines_updated, final=False): +def diff_partial_update(lines_orig, lines_updated, final=False, fname=None): """ Given only the first part of an updated file, show the diff while ignoring the block of "deleted" lines that are past the end of the @@ -72,6 +72,8 @@ def diff_partial_update(lines_orig, lines_updated, final=False): diff += "\n" show = "```diff\n" + if fname: + show += f"@@ {fname}\n" if not final: show += bar