Sean
Sean

Reputation: 333

Disable Intellij IDEA append space after code autocomplete

An example: When I want to type public, I type pub and press tab, IDEA automatically append a space after public, how can I turn off it.

Because I am used to tapping space after autocompletion, so every time after that, there are 2 spaces and I have to delete one. Other IDEs or text editors I've used seem not to append that space automatically.

Upvotes: 5

Views: 540

Answers (1)

Koyasha
Koyasha

Reputation: 6857

You cannot disable this particular piece of autocomplete behavior in IDEA short of disabling autocompletion feature altogether.

You can, however, use the 'Reformat' action to apply single default format to your whole file (Ctrl+Alt+L) or 'Complete Current Statement' action after you are done typing a construct (highlight the statement and press Ctrl+Shift+Enter). Conformed to the default formatting settings, double spaces should be replaced with single ones.


Assuming that this is for Java code (although the general mechanism is true for most file types), you can modify when/how spaces are used in code.

Go to File | Settings | Code Style | Java.

If you then click on the Spaces tab you can specify the code layout you want. After you've done this if you reformat your code it should format according to your preferences.

You can specify this for other types too (General, CSS, JavaScript and so on).

Upvotes: 1

Related Questions