Change how eclipse formatter wraps long strings

倾然丶 夕夏残阳落幕 提交于 2019-11-27 15:41:14

问题


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?


回答1:


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)



来源:https://stackoverflow.com/questions/11289076/change-how-eclipse-formatter-wraps-long-strings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!