2013-04-18 39 views
5

問題1:IntelliJ可以設置爲在創建新行時自動縮進代碼體?我可以將IntelliJ設置爲自動縮進代碼體?

這裏是我的意思的例子:

我有這樣的方法:

public static void main(String[] args) 
     { 
      System.out.println("Hi there."); 
     } 

在打打字表達後返回鍵,我得到這個:

public static void main(String[] args) 
     { 
      System.out.println("Hi there."); 
     // the new line aligns itself with the braces. 
     } 

我想這樣做:

public static void main(String[] args) 
     { 
      System.out.println("Hi there."); 
      // the new line aligns itself with the preceding line 
     } 

我一直無法找到設置下的任何選項,這會使其成爲默認行爲。它是否存在,我是否錯過了它,還是我正在尋找獨角獸?

問題2:是否有一個選項讓代碼主體默認縮進?如果是這樣,它可以在哪裏找到?

例子:

在使用「重新格式化代碼...」命令,我得到這個:

public static void main(String[] args) 
     { 
     System.out.println("Hi there."); 
     // the code body is realigned with the braces 
     } 

是否有可能設置的IntelliJ要做到這一點,如果是的話,我可以在哪裏找到該選項?:

public static void main(String[] args) 
     { 
      System.out.println("Hi there."); 
      // the code body is indented from the braces 
     } 

這是我在「設置」選項中看不到的另一件事。

任何幫助將是偉大的。謝謝你的時間。

回答

4

您應該使用Next line, each shifted選項:

enter image description here

0

IntelliJ IDEA的15

文件>設置...>編輯>代碼樣式>的Java>包裝和大括號>括號放置>在方法聲明>下一行,每個移位

Next line each shifted

相關問題