joachimschmidt557 / linenoize

A port of linenoise to zig
MIT License
55 stars 9 forks source link

Instant completions #7

Open notramo opened 1 year ago

notramo commented 1 year ago

Is it possible to provide completions on every keystroke?

joachimschmidt557 commented 1 year ago

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.

notramo commented 1 year ago

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:

notramo commented 1 year ago

@joachimschmidt557 any thoughts on this?

joachimschmidt557 commented 1 year ago

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

Unfortunately, I currently don't have the time or resources to implement this myself.