2017-09-24 87 views
0

我试图在IntelliJ中创建一个代码风格,以保持格式一致。我想确保没有超出正确的边距,但是当我重新格式化和IntelliJ试图强制执行时,通常会导致一些非常奇怪的线条。IntelliJ代码风格只在空白

例如,它常常喜欢打破线,导致类似

public static final String SOME_CONSTANT_STRING = "A long string that is cut" + 
     + " off in the middle."; 

一个字符串中间我想什么,而不是,是的IntelliJ仅在空白断行太行反而会看起来像

public static final String SOME_CONSTANT_STRING = 
     "A long string that is cut off in the middle"; 

这种行为可能吗?

回答

1

Preferences > Editor > Code Style > Java > Wrapping and Braces ...

  • Assignment statement > Wrap if long
  • Assignment statement > Align when multiline

这里的显示配置的截图:

enter image description here

下面是截图SH由于将此格式化程序应用于声明一个很长的字符串常量之后的结果:

enter image description here