From d30fb94c72d4fd1d2512a6a40020629c6ae15a2b Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 5 Jul 2023 20:48:09 -0700 Subject: [PATCH] refactor to use io.read_text --- aider/coders/wholefile_func_coder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/coders/wholefile_func_coder.py b/aider/coders/wholefile_func_coder.py index f45ef48a7..5c7cbd6ae 100644 --- a/aider/coders/wholefile_func_coder.py +++ b/aider/coders/wholefile_func_coder.py @@ -101,8 +101,11 @@ class WholeFileFunctionCoder(Coder): # ending an existing block full_path = os.path.abspath(os.path.join(self.root, fname)) - with open(full_path, "r") as f: - orig_lines = f.readlines() + content = self.io.read_text(full_path) + if content is None: + orig_lines = [] + else: + orig_lines = content.splitlines() show_diff = diffs.diff_partial_update( orig_lines,