2017-09-24 51 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