24

Here is an example of an issue I have. In Intellij if I am typing in front of String:

private statString foo = "bar";

And then I autocomplete static, String will be deleted. Is there a way to change the settings so that the autocomplete does not delete text?

Nelson
  • 2,972
  • 3
  • 23
  • 34
  • 2
    Possible duplicate of [IntelliJ autocompletion replacing the subsequent word](https://stackoverflow.com/questions/35424303/intellij-autocompletion-replacing-the-subsequent-word) – ash Sep 05 '18 at 11:56

3 Answers3

26

If you select from the autocomplete dropdown and press [Tab], the the selection replaces the following text.

You have to use [Return] to accept the autocomplete to have it inserted.

P.J.Meisch
  • 18,013
  • 6
  • 50
  • 66
  • To add to this, this behavior, to the best of my knowledge, cannot be changed. See https://www.jetbrains.com/help/idea/2016.2/discover-intellij-idea.html#CodeCompletion for more information. – Javaru Aug 09 '16 at 14:42
  • 36
    This behavior can be changed by changing the keybindings for "Choose Lookup Item" and "Choose Lookup Item and Replace" in Settings | Keymap. – yole Aug 09 '16 at 18:05
  • @yole It has been annoying me for a long time, thanks for the final solution! – Kelvin Hu Apr 17 '18 at 03:00
  • 3
    This does not answer the question and should not be marked as the correct answer. @yole has the correct answer for "[How to] Turn off autocomplete tab deletion in Intellij" – Reimus Klinsman Nov 08 '19 at 17:44
  • 1
    @yole saved me a ton of time - thanks! added your comment as an answer (can't convert your comment to answer, and just posted my own. Open to deleting mine if you want to post your own answer instead yole.) – nokola Dec 09 '20 at 04:06
17

Per @yole's answer, adding screenshot showing how to in Rider/IntelliJ to prevent tab from overwriting text. In Settings, change the editor actions for Choose Lookup Item and Choose Lookup Item Replace:

how to make Tab not delete text

nokola
  • 336
  • 3
  • 6
2

Does pressing enter key instead of tab key works for you?

mgershen
  • 1,567
  • 16
  • 22