For each method, I want to add a space between the method name and the right curly bracket. For example,
public void setName(String name) {
}
I want a space between ) and {. Is it possible to automatically set this in Eclipse or somewhere? It's annoying to add this space every time.
Go to Source | Format Document or press Ctrl+Shift+F.
All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.
To change these settings, use Window -> Preferences -> Java -> Code Style -> Formatter. On the last tab of the formatter, you can define on/off tags which allow to you to prevent reformatting of some code.
in eclipse menu-->Windows-->preferences, search for the formatter, then edit then set the checkbox: insert space before opening brace
Default code style will add space where you want it, and it can be autoformatted on every save:
Window->Preferences->Java->Editor->SaveActions: check "Format source code"
In case you want to change some of the default styles, you can do so if you navigate to formatter and edit active profile there:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With