簡體   English   中英

IntelliJ IDEA 13:格式化Java的代碼樣式“引發新變化”

[英]IntelliJ IDEA 13: Formatting Code Style for Java “throw new”

我正在使用IntelliJ 13的“代碼樣式”功能來自動格式化我們的Java代碼,但我不知道如何格式化throw new Exception("details")以便"details"部分與throw new

我要這個:

if (connection == null) {
        throw new SQLException( "ERROR: Attempted to start a database transaction with a null connection." );

但是在輸入OPTION + COMMAND + L (在Mac上)以應用格式后,我仍然得到此信息:

if (connection == null) {
        throw new SQLException(
            "ERROR: Attempted to start a database transaction with a null connection." );

我已經嘗試了Project Settings > Code Style > Java > Wrapping and Braces下的幾乎所有代碼樣式選項,但似乎找不到正確的設置。

謝謝你的幫助!

好吧,似乎IntelliJ正在創建這些換行符,因為我的"details"的內容足夠長。 似乎存在一個小錯誤,在縮短"details"字符串文字然后重新應用代碼樣式之后,換行符不會恢復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM