From 9c2f8e22d87d0eac5ab2851e2884b55d1bbe1d2f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 13 May 2023 15:21:26 -0700 Subject: [PATCH] wip: Refactor file mentions check in Coder class to strip away all kinds of quotes and drop sentence punctuation. --- aider/coder.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aider/coder.py b/aider/coder.py index aac27fd4c..96cd67c6e 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -298,8 +298,13 @@ class Coder: def check_for_file_mentions(self, content): words = set(word for word in content.split()) - for quote in ['"', "'", "`"]: - words = set(word.strip(quote) for word in words) + + # drop sentence punctuation from the end + words = set(word.rstrip(',.!;') for word in words) + + # strip away all kinds of quotes + quotes = ''.join(['"', "'", "`"]) + words = set(word.strip(quotes) for word in words) addable_rel_fnames = set(self.get_all_relative_files()) - set( self.get_inchat_relative_files()