mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
aider: Updated FileContentCompleter to split files into words on non-alphanums.
# Context: USER: have FileContentCompleter(Completer) split the files into words on non-alphanums. so each word is a contiguous sequence of alphanums. non-alphanums are ignored, and only used to split. ASSISTANT: To achieve this, you can update the regular expression used in the `re.split()` function inside the `FileContentCompleter` class. You can use the `\W+` pattern to split the content based on non-alphanumeric characters. Here's the change: ```python aider/getinput.py <<<<<<< ORIGINAL for word in re.split(r"\W+", content): ======= for word in re.split(r'\W+', content): >>>>>>> UPDATED ``` This change will ensure that the content is split into words based on non-alphanumeric characters, and each word will be a contiguous sequence of alphanumerics.
This commit is contained in:
parent
3425adee28
commit
3f949e63a0
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ class FileContentCompleter(Completer):
|
|||
with open(fname, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
for word in re.split(r"\W+", content):
|
||||
for word in re.split(r'\W+', content):
|
||||
if word.startswith(last_word):
|
||||
yield Completion(word, start_position=-len(last_word))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue