Annotations on the same line Follow
Is it possible to change the formatting options putting the annotations on the same line of the field?
As an example, here's how IDEA format my code each time I press enter:
I would like to have
@MyAnnotation MyClass MyField;
This is especially useful in Seam and it will be almost mandatory in Java EE 6.
Thank you very much.
Please sign in to leave a comment.
You can set the following option 'Project Settings -> Code Style -> Wrapping -> Field annotations' to 'Do not wrap'.
That instructs IDEA to avoid inserting line break between field annotation and definition.
Thanks a lot
One note - it may be even more convenient for you to use 'Wrap if long' instead of 'Do not wrap'.
Just one more thing. It appears that using code completition still wraps the text.
Would you please check this?
Thank you again.
Please provide exact steps to reproduce problem scenario.
I just tried the following and no wrap is performed:
We have complete field declaration now that is located on a single line. Checked with IDEA 9.0.2.
I managed to reproduce, it's not with code completition, but with import suggest:
@MyAnnotation List myList;
- Import suggest for "java.util.list"?
2. Press ALT+ENTER
- Voilà: two lines.
IDEA 9.0.2 for me too.
Thanks for your understanding
No wrap is performed for me in that case (still IDEA 9.0.2)