Xcode completion menu not completing on enter, I have to use mouse/touchpad cursor and click there...

Xcode completion menu not completing on enter, I have to use mouse/touchpad cursor and click there, so its quite annoying. How can I just autocomplete by keyboard ? Is this some miss-configuration of keybindings ? I never used Xcode editor so I am not sure if this is not standard behavior... Coming from App-code so I am used to do everything by keyboard but most of keybindings I had to re-configure...


Solution 1:

This is weird and seems to be a bug in your installation somehow, i.e. it's certainly not how Xcode is supposed to work.

The standard shortcut to open the code completion menu (which seems to work for you, I'm just being thorough here) is Alt+Esc. For some reason simply pressing Esc also works (at least for me, has always been that way and I always used the default settings in Xcode).

Stepping through the suggestions has, according to the settings, the shortcuts Ctrl+. (that's a full stop) and Ctrl+, but using the arrow keys also works for me (and always has), in spite of not being defined in the settings.

Selecting/confirming an entry doesn't even have a shortcut per se, because it's less an Xcode and more of a standard selection mechanism for any similar kind of list under macOS I guess. It doesn't even show up in the settings as far as I can see it. For me (and everybody else I have ever worked with) it's done as you expect as well: Pressing Return or Enter (both work).

This unfortunately only answers half of your question: As said, the behavior you see is not the standard (or to be expected at all).

I'd suggest to take a look at the "Key Bindings" section of the Preferences ("Xcode - Preferences..." menu), though I assume you already did that. It can list conflicts for you. Other than that you also might want to take a look at the general input settings (" - System Preferences... - Keyboard"). You can also define various keyboard shortcuts there, maybe that's causing some kind of conflict.

Solution 2:

I had the same problem, turns out I somehow messed with my key bindings.

To fix this, I removed the following entry from ~/Library/Developer/Xcode/UserData/KeyBindings/Default.idekeybindings, and then restarted Xcode:

-           <key>
-</key>
-           <string>insertNewline:</string>