atom/autocomplete-plus

Remove enter as default confirmation key

Closed this issue ยท 21 comments

The tooltip with the suggestions shouldn't have an option selected by default.
Im using this with the "live completion" enabled, but because of the default selection I can't using in conjunction with emmet or even with my custom snippets. This happens because when I try to expand a snippet, most of the times there's a autocomplete suggestion that will expand instead.

+1 this is just generally bad UX. It is autocompleting things when i just want to hit enter for a new line

๐Ÿ‘ i love autocomplete-plus but that it selects the first match is a bit confusing and you need to hit esc first before enter.

Most people seem to not like enter as an accept key. I will remove this after refactoring.

Changing the title of this issue btw :)

This is a duplicate of #20 then.

@saschagehlich cool! thanks.

However I think it is not the issue of enter being the accept key, but rather that in the autocomplete the first one is selected by default.

If the behaviour would be changed to not select the first one by default, but rather let them be selected via arrow keys and then enter.

@bastilian That would mean that everytime you want to autocomplete something, you would have to move over to the arrow keys, press down one time and then enter. Personally, I'm using autocompletion a lot and I'd like to have a default selection.

Sublime Text does it the same btw. :)

Closing this issue since it's a duplicate. Feel free to keep discussing though.

@saschagehlich oh, i didn't have a look at #20 till now. The solution there mentioned is perfect! Thanks. ๐Ÿ‘

The problem with TAB as the accept key is that it will conflict with snippets expansion, such as user snippets or things like emmet. The enter key as the only way to accept a autocompletion suggestion would solve this problem I believe, but that's not what the plugin is doing right now.

@lmartins As I already said, you will be able to configure the key yourself.

pjv commented

How can I configure the key?

I tried to over-ride the default "tab" by using "unset!" in my keymap, but it doesnt work. so far i have not found a way to stop tab from completing and that messes me up with snippet expansion.

this is what my keymap looks like:

'.autocomplete-plus input.hidden-input': 'tab': 'unset!' '.autocomplete-plus input.hidden-input': 'enter': 'autocomplete-plus:confirm'

@saschagehlich Let me just say that this last update and the new add-on autocomplete+ snippets totally transformed the way I use Atom. Finally I can use the suggestion feature. Thank you.

@pjv: This way it works:

'.autocomplete-plus input.hidden-input':
  'tab': 'unset!'
  'enter': 'autocomplete-plus:confirm'

@lmartins Thank you very much! I just added another one: autocomplete-paths

pjv commented

@saschagehlich thanks for both the proper keymap stanza and the paths!

@saschagehlich Is there a way we can configure it to not select an option in the dropdown unless you move down into it? This gets particularly annoying with JS objects, when all you want is a new line and the thing will autocomplete some (usually completely useless) suggestion ahead of your comma on the same line instead.

This is one of those tricky things where a default can never please anyone. You have the ability to change this in autocomplete-plus preferences, and you should do so. You can also set this via your keymap.

screen shot 2015-06-24 at 10 03 40 am

This is literally the reason why I use VSCode more than Atom right now. Not having enter as a select key after I select something throws me off, because I hit enter and get a new line when I wanted a selection. Having something selected by default with enter enabled does too because I hit enter wanting a newline and get something I didnโ€™t deliberately select. I am used to autocomplete working a certain way and retraining myself didnโ€™t work so I just use an editor that works closer to the way I am used to.

@geoffreywiseman I know I'm two months late but this is possible now:

image

Great -- I'll give this a shot. Thanks for letting me know.

You can also use ctrl+enter if you don't want to select the suggestion and go to the next line but also have the benefits of a simple enter when you want to select the suggestion. Works fine for me.

@nyuszika7h Could you direct me to where the Keymap For Confirming A Suggestion is found? I am a new user, using using Atom 1.35.1 and haven't been able to locate this setting.

rsese commented

@jcbalmer it's at Settings > Packages > Autocomplete Plus > Keymap For Confirming A Suggestion.