mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
Add FileHistory to get_input method in Coder class.
# Context: USER: have get_input(self): use a FileHistory with the history_file ASSISTANT: To use a FileHistory with the history_file in the get_input(self) method, we need to import FileHistory from prompt_toolkit.history and use it when calling the prompt function. Here's the change: ```python coder.py <<<<<<< ORIGINAL from prompt_toolkit import prompt from prompt_toolkit.completion import Completer, Completion ======= from prompt_toolkit import prompt from prompt_toolkit.completion import Completer, Completion from prompt_toolkit.history import FileHistory >>>>>>> UPDATED ... class Coder: ... def get_input(self): ... while True: try: completer_instance = FileContentCompleter(self.fnames) if multiline_input: line = prompt(". ", completer=completer_instance, history=FileHistory(self.history_file)) else: line = prompt("> ", completer=completer_instance, history=FileHistory(self.history_file)) except EOFError: return ``` This change imports FileHistory and adds it as an argument to the prompt function calls in the get_input method.
This commit is contained in:
parent
fe222d8943
commit
bc2c59368b
1 changed files with 2 additions and 1 deletions
3
coder.py
3
coder.py
|
@ -6,6 +6,7 @@ import re
|
|||
import traceback
|
||||
from prompt_toolkit import prompt
|
||||
from prompt_toolkit.completion import Completer, Completion
|
||||
from prompt_toolkit.history import FileHistory
|
||||
from rich.console import Console
|
||||
from rich.prompt import Confirm, Prompt
|
||||
from colorama import Fore, Style
|
||||
|
@ -499,4 +500,4 @@ if __name__ == "__main__":
|
|||
from main import main
|
||||
|
||||
status = main()
|
||||
sys.exit(status)
|
||||
sys.exit(status)
|
Loading…
Add table
Add a link
Reference in a new issue