Intellij code formatting, Java annotations on new lines
JavaFormattingIntellij IdeaJava Problem Overview
I'm using IntelliJ 12 and It's putting my member variable annotations on the same line, which i hate! How do I setup the code formatter to keep annotations on separate lines?
thanks!
Java Solutions
Solution 1 - Java
Navigate to Preferences → Editor → Code Style → Java → Wrapping and Braces tab, then locate the section Field annotations and check the option Do not wrap after single annotation.
In IntelliJ v14:
Solution 2 - Java
In IntelliJ 12 You can find it in setup here (bottom right):
Solution 3 - Java
I think all the above answers are correct but here is step by step for Mac users:
- Click on "IntelliJ IDEA"
- Click on "Preferences"
- Go "Code Style" on the left navigation window and you will see "Java" listed below it and Click on it !
- Look for the header tab "Wrapping and Braces" on the right side of Preferences window.
- At this point you want to look for the item called "Do not wrap after single annotation" under "Field annotations". click "ok" and you are done !