IntelliJ autocompletion replacing the subsequent w

2019-02-06 04:19发布

问题:

I've been using IntelliJ for a while now, but there's always been something that bothers me. Its to do with the autocomplete feature. This gif should be enough to illustrate.

In essence, when typing a word next to another one (that is with no space in between) regardless of the two words or the context, be it keywords or variables, the autocomplete will replace the next word by the one you complete with. I/m surprised that IntelliJ doesn't have a setting for that (at least not that I'm aware of) considering Eclipse does...

Thanks in advance!

回答1:

This behavior depends on the key that you use to select the item from the completion list. If you press Enter, the selected item is inserted in the code before the following identifier. If you press Tab, the selected item replaces the identifier following the cursor.

If you prefer, you can change the behavior by reassigning keyboard shortcuts for "Choose Lookup Item" and "Choose Lookup Item Replace" under Settings | Keymap.