Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change how eclipse formatter wraps long strings

I have set the eclipse java formatter to wrap lines that exceed 120 characters to conform to our team's coding standard. However, when I have a long string that is wrapped I want the plus sign (+) to appear as the last character on the first line e.g.

String s = "Very long line that should be " +
"wrapped across several rows"; 

The default behaviour is that the plus sign is placed on its own line e.g.

String s = "Very long line that should be "
+
"wrapped across several rows";

So is it possible to specify where the plus sign should appear in the eclipse java formatter?

like image 927
Mathias Åhsberg Avatar asked Jul 02 '12 07:07

Mathias Åhsberg


1 Answers

Preferences > Java > Code Style > Formatter > Line Wrapping > Binary Expressions > Wrap before Operator

The above controls where + is placed. (Though it should never be on a its own line)

like image 167
Deepak Azad Avatar answered Oct 13 '22 17:10

Deepak Azad