Home » Android » java – How to prevent Android Studio autocomplete removing adjacent token

java – How to prevent Android Studio autocomplete removing adjacent token

Posted by: admin June 15, 2020 Leave a comment

Questions:

If I’m editing an existing line of code in Android Studio, and accept an autocomplete, the following token to the right of the cursor gets eaten:

enter image description here

Is there a way to disable this behaviour, keeping both the autocomplete plus the rest of the line?

How to&Answers:

If you press “Enter” it just pastes in the autocomplete, if you press “Tab” it replaces it. I would guess you are always pressing “Tab”, so try “Enter” and see if you like how that works.

Full Documentation from JetBrains

Here’s the TLDR;

  1. Use Enter to insert the selected string at the insertion point.
  2. Use Tab to replace the string next to the caret with the selected one.
  3. Use Ctrl+Shift+Enter to make the current code construct syntactically correct (balance parentheses, add missing braces and semicolons, etc.)