简体   繁体   English

如果转到下一行,Intellij 格式化程序强制单行

[英]Intellij formatter force single line if go to next line

Intellij formatter has something I hate very much and can't figure out a way to disable. Intellij 格式化程序有一些我非常讨厌并且无法找到禁用方法的东西。

when pressing ctrl+alt+l to format code all my single line ifs without parentheses goes to one line当按 ctrl+alt+l 格式化代码时,我所有的单行 ifs 没有括号转到一行

something like就像是

if(true)
System.out.println("yes");

goes:去:

if(true) System.out.println("yes");

the multiline ifs with braces keep the original formatting but i hate very much this behavior... does anyone know how to change it?带大括号的多行 ifs 保留了原始格式,但我非常讨厌这种行为......有人知道如何改变它吗?

Go to Settings/Preferences | Code Style | Java | Wrapping and Braces | Keep when reformatting转到Settings/Preferences | Code Style | Java | Wrapping and Braces | Keep when reformatting Settings/Preferences | Code Style | Java | Wrapping and Braces | Keep when reformatting Settings/Preferences | Code Style | Java | Wrapping and Braces | Keep when reformatting and enable Line breaks option. Settings/Preferences | Code Style | Java | Wrapping and Braces | Keep when reformatting并启用换行选项。

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

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