Reputation: 1681
IntelliJ has some such facilities and options. For example, I want it to format like:
@Override public
void foo()
{ ... }
Better yet would be the ability to indent the annotations and visibility like so
@Override public
void foo()
{ ... }
but I don't want to be greedy.
Do such formatting options exist in Eclipse?
Upvotes: 5
Views: 5682
Reputation: 881
Go to settings-> Editor-> Code Style -> Java
Choose your code formatter and choose tab Wrapping and Braces (Try to find tab Wrapping if using different Intellij Version).
Look for option Class Annotation and Method Annotation and select option "Wrap Always"
Upvotes: 2
Reputation: 7216
In case you still have Annotation formatting problems in Eclipse 2018 (Oxygen.3a, 4.7.3a) try this:
In Preferences go to: Java -> Code Style -> Formatter -> Edit --> New Lines --> Annotations:
You have to select Annotations and then set "line wrapping policy" to a "Wrap ..." setting. Without this setting any complex set of Annotations was formatted to very long lines in Eclipse
Upvotes: 3
Reputation: 21186
Java -> Code Style -> Formatter -> Edit --> New Lines --> Annotation:
Unclick Insert new line after annotations on methods
Don't think you can do your second option.
Upvotes: 4
Reputation: 12718
Open the preferences dialog. Go to "Java" -> "Code Style" -> "Formatter".
Check the many options :-)
Upvotes: -3