[Autocompletion] Disable 'Enter' binding

101 views
Skip to first unread message

Nicolas LockFace

unread,
Oct 2, 2020, 11:15:28 AM10/2/20
to Ajax.org Cloud9 Editor (Ace)
Hello,

For autocompletion I would like to use only the "tab" key binding and remove the autocompletion when "enter" is pressed. Because it is annoying to force the user to paste the autocomplete thing when he press enter.

Sincerely,
Lockface77

Nicolas LockFace

unread,
Oct 5, 2020, 3:48:40 AM10/5/20
to Ajax.org Cloud9 Editor (Ace)
Hello again

I found the solution to do this, I don't know if it is the cleanest one but it is working.

It works by deleting a field in aceEditor:

// This will delete autocompletion when the user clicks on "return"
delete aceEditor.completer.keyboardHandler.commandKeyBinding.return;

you can also add an if to be sure to not delete something that does not exists:
if (aceEditor.completer.keyboardHandler.commandKeyBinding.return)
     delete aceEditor.completer.keyboardHandler.commandKeyBinding.return;

Hope the answer help some people :)

vanessa....@gmail.com

unread,
Feb 24, 2023, 1:42:19 AM2/24/23
to Ajax.org Cloud9 Editor (Ace)
Hitting Enter key or Tab key in the ace editor keeps pasting the previously selected entry in the autocomplete popup even though the autocomplete popup is hidden at the moment. Setting completers to empty array did not help. I don't want to remove key binding for Tab key either. Any better solution? Thanks.

Harutyun Amirjanyan

unread,
Feb 24, 2023, 3:07:44 AM2/24/23
to ace-d...@googlegroups.com
Sounds like there is some exception being thrown in autocomplete. Could you give a link to a webpage where this issue can be reproduced?
--
You received this message because you are subscribed to the Google Groups "Ajax.org Cloud9 Editor (Ace)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ace-discuss/6b012f5b-de6c-4ef0-be25-17653a8e15dcn%40googlegroups.com.

vanessa....@gmail.com

unread,
Feb 27, 2023, 2:34:22 PM2/27/23
to Ajax.org Cloud9 Editor (Ace)
I have not had time to construct a sample code in a link yet. However, I found that if I hit Escape button, then subsequent Enter or Tab hit (while autocomplete popup is hidden) will not auto-paste the previously selected entry.
I think it is because Escape command triggered a call to editor.completer.detach() as per https://github.com/ajaxorg/ace/blob/v1.2.9/lib/ace/autocomplete.js#L185
I am ok with this for now. I don't think I need to remove key binding for Enter key nor Tab key any more.
I need help with the following issue in this thread instead:
To unsubscribe from this group and stop receiving emails from it, send an email to ace-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages