Instant completions
Is it possible to provide completions on every keystroke?
I personally don't think arbitrary changes to the input buffer on normal keystrokes is intuitive for users. Normal keystrokes (all input except cursor movement, tab, enter, backspace, etc.) should have a predictable behavior. For showing additional helpful data to the input, there is the hints API.
The hints API and the completions API can also be used together to provide a smooth experience like in the fish shell. A hint can be shown to indicate what would be inserted into the buffer if the tab key was pressed. When the tab key is pressed, the program delivers this exact input as the first completion option.
It wouldn't change the input buffer. It would only show the completion list. When the user presses Tab, the first list item would be inserted.
It would work the same as the command mode (:) of the Kakoune editor.
Basic summary:
- The completion callback is called on every keystroke, and the results are displayed.
- When the user presses
Tab, the first item from the list is inserted into the buffer.
@joachimschmidt557 any thoughts on this?
Currently, we don't have functionality for displaying all possible completions in a nicely formatted list on-demand (similar to bash on-demand completion of files in the current working directory or executables in PATH when pressing Tab).
I would merge a Pull Request which implements this feature given that
- the completion mechanism which displays all available completions in a list can be set to activate either manually on Tab press (like bash) or automatically on each key press (like kakoune)
- it is possible to opt out of this completion mechanism in its entirety (preserving the current behavior)
Unfortunately, I currently don't have the time or resources to implement this myself.