autocomplete-plus
autocomplete-plus copied to clipboard
Is it possible to have auto complete only triggered after selection?
Would it be possible to add another setting to the auto complete package, to have the auto complete only be triggered after selection of an item (using arrow down/up keys)?
Right now, the first option is always selected by default, so that when you hit TAB or ENTER, it is always selected. This causes the occasional annoyance when you actually want to insert a TAB or new line, but don't want to insert the autocomplete suggestion.
In addition, the TAB trigger often conflicts with some existing snippets I have (which are also triggered by TAB), and autocomplete seems to take precedence over them.
It would be nice if there was an option to not have the first suggestion be auto selected, so that to use the auto complete suggestions, you'd explicitly have to hit arrow down, and then enter/tab. Can such an option be implemented without too much hassle?
For now you could set the Keymap for Confirming a Suggestion to Enter in the settings.
That would resolve the TAB trigger conflicts you described.
However if you tried to add a new line after typing something that triggers autocomplete you would still confirm the autocomplete suggestion.
@adambuczynski There is a debate about your question in #240.
Thanks for the heads up @kepbod
+1, this is very frustrating for me as I often type a word and try to create a new-line, but instead the autocompletion is triggered from the Enter.
I was very disappointed to find out that this wasn't the behaviour associated with the 'tab+enter' option. In my understanding that meant 'use tab to select the completion, then enter to confirm'.
A possible quick work around fix for this issue would be to allow a custom key for the confirmation of a suggestion instead, so that we can choose another key instead of the predescribed options ENTER or TAB.

Can this be made a free input field somehow?
I would also be happy if TAB + ENTER would actually mean that you need to press both TAB and ENTER to confirm the selection, as it would prevent auto completion from being triggered when I just want to insert a new line or tab.
As I have already written elsewhere, autocompletion also sometimes eats return key presses for me while typing.
While in C/C++ the impact is less serious because a line is usually terminated with a semicolon which will terminate the autocompletion, this is a major annoyance for languages where an identifier can regularly be at the end of the line, as for example in lua or when assigning one variable to another in Python.
I appreciate that it's meant to be easy to use, but if that means that the autocompletion interferes with regular typing that is absolutely unacceptable. If people still really really need this on regular return key (instead of CTRL+return or whatever other choice), then don't make this the default behavior. Again while it's not so bad in C/C++/Java, it is super annoying and problematic in Lua/Python/others.
TL;DR: "tab and enter" is a horrible default choice the way it works now, "tab always, enter when explicitly selected" would be better, but really this should be shift+enter, tab+enter or something (as default, not the only choice!) with the popup simply including a short instruction line below/above the suggestions "Press shift+enter to choose" or whatever the current setting is, which would avoid the problem that shift+enter or similar wouldn't be as easily guessable. Interfering with regular typing is evil.
By the way, switching to the style proposed in #240 as a default also sounds like a potential major improvement, since I'm much less likely to use the down array key during regular typing. (than for example tab or return, which I'm hitting all the time, and if not writing C/C++ then often right after identifiers/keywords which the autocompletion wants to fiddle around with and help me, but then ends up eating my newlines which is frustrating and annoying)
Is there a solution for this yet?
Having autocomplete+ automatically use the selection, e.g. where I intend to intentionally insert a tab or an enter, but then autocomplete uses it for the suggestion (without requiring manual selection) is literally the most aggravating thing in existence.
@JonasT Thanks, unfortunately that still doesn't solve it when there's only one suggestion (e.g. if there is only one selection it will automatically use it if you hit enter, so there's no 'explicit selection' in that case).
I've found myself disabling the auto-suggestion popup menu and switching to it being 'manually triggered' to avoid all the issues.