aider: Saving dirty files before chat

# Context:
USER: move that import up with the others
ASSISTANT: To move the import statement to the top with the other imports, make the following change:

```python
aider/getinput.py
<<<<<<< ORIGINAL
from prompt_toolkit.styles import Style

from prompt_toolkit import prompt
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory
=======
import re
from prompt_toolkit.styles import Style

from prompt_toolkit import prompt
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory
>>>>>>> UPDATED

```

This change moves the `import re` statement to the top with the other import statements.
This commit is contained in:
Paul Gauthier 2023-05-09 14:13:41 -07:00
parent a87de46371
commit b1fa3b91f9

View file

@ -1,10 +1,10 @@
import re
from prompt_toolkit.styles import Style
from prompt_toolkit import prompt
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.history import FileHistory
class FileContentCompleter(Completer):
def __init__(self, fnames):
self.fnames = fnames
@ -19,7 +19,7 @@ class FileContentCompleter(Completer):
for fname in self.fnames:
with open(fname, "r") as f:
content = f.read()
import re
for word in re.split(r'\W+', content):
if word.startswith(last_word):
yield Completion(word, start_position=-len(last_word))