Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant completions #7

Open
notramo opened this issue Nov 12, 2022 · 4 comments
Open

Instant completions #7

notramo opened this issue Nov 12, 2022 · 4 comments

Comments

@notramo
Copy link

notramo commented Nov 12, 2022

Is it possible to provide completions on every keystroke?

@joachimschmidt557
Copy link
Owner

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
Copy link
Author

notramo commented Nov 13, 2022

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.

@notramo
Copy link
Author

notramo commented Mar 5, 2023

@joachimschmidt557 any thoughts on this?

@joachimschmidt557
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants