Connect FileContentCompleter to prompt() call in get_input() for autocompletion.`

# Context:
USER: connect the filecontentcompleter to the prompt() call in get_input, so that it autocompletes
ASSISTANT: To connect the `FileContentCompleter` to the `prompt()` call in the `get_input` method, you need to pass the `FileContentCompleter` instance as the `completer` argument in the `prompt()` function. Here's the change:

```python
coder.py
<<<<<<< ORIGINAL
            if multiline_input:
                line = prompt(". ")
            else:
                line = prompt("> ")
=======
            completer_instance = FileContentCompleter(self.fnames)
            if multiline_input:
                line = prompt(". ", completer=completer_instance)
            else:
                line = prompt("> ", completer=completer_instance)
>>>>>>> UPDATED
```

This change will enable autocompletion using the `FileContentCompleter` when you call `prompt()`.
This commit is contained in:
Paul Gauthier 2023-05-09 09:20:58 -07:00
parent 36d15d5f37
commit 59e664e220

View file

@ -156,10 +156,11 @@ class Coder:
while True:
try:
if multiline_input:
line = prompt(". ")
else:
line = prompt("> ")
completer_instance = FileContentCompleter(self.fnames)
if multiline_input:
line = prompt(". ", completer=completer_instance)
else:
line = prompt("> ", completer=completer_instance)
except EOFError:
return
if line.strip() == "{" and not multiline_input: