简体   繁体   English

Eclipse格式化程序:大于符号而不是点符号

[英]Eclipse Formatter: Break at Greater-Than Sign Rather Than at Dot

I have this line showing the problem: 我有这行显示问题:

Which setting in the Eclipse Java formatter do I have to change so the line will break like 我必须更改Eclipse Java格式化程序中的哪个设置,以便该行会像

return this.data.getNumberOfGenerationsWithoutSignificantImprovementPassed()
            > MAX_NUMBER_OF_GENERATIONS_WITHOUT_SIGNIFICANT_IMPROVEMENT;

or like 或喜欢

return this.data.getNumberOfGenerationsWithoutSignificantImprovementPassed() >
            MAX_NUMBER_OF_GENERATIONS_WITHOUT_SIGNIFICANT_IMPROVEMENT;

? If both is possible, I prefer the former. 如果两者都有可能,我更喜欢前者。

On Mac, go to Eclipse -> preferences. 在Mac上,转到Eclipse->首选项。 On Windows, I believe it is Windows -> preferences... but don't quote me on that! 在Windows上,我相信它是Windows->首选项...但是不要在此引用我!

  • Expand Java -> Code Style -> Formatter 展开Java->代码样式->格式化程序
  • To the right of the "Active profile" bar, choose edit. 在“活动配置文件”栏的右侧,选择“编辑”。
  • A new window will open- choose the "Line Wrapping" tab. 将打开一个新窗口,选择“包装线”选项卡。
  • Scroll down to "Expressions" and choose conditionals. 向下滚动到“表达式”,然后选择条件。 Pick your favorite! 选择你喜欢的!

Bonus points: This is where you can set all sorts of different styles, if you have not before, like number of spaces per tab character. 奖励点:在这里,您可以设置各种不同的样式(如果以前没有过的话),例如每个制表符的空格数。 Once you get everything set up just right, name your profile and export it. 完成所有设置后,命名您的个人资料并导出。 I use the same theme on 3 different computers and the consistency is nice! 我在3台不同的计算机上使用相同的主题,一致性很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM