Prevent IntelliJ from removing newlines around single statement methods?

时间:2016-07-11 22:08:04

标签: java intellij-idea

Sometimes IntelliJ will take single statement methods and put them on the same line, as seen here:

If I click either bracket it will turn back into:

This question isn't a debate for which of the two is better - I want to know how to turn this off. I combed through IntelliJ preferences and couldn't seem to find anything, and searching both here and Google didn't bring up what I wanted.

2 个答案:

答案 0 :(得分:6)

I think these options are responsible for this: enter image description here

答案 1 :(得分:-1)

如果您正在谈论代码重新格式化将额外的换行符放入代码中,那么您需要在编辑器/代码样式/ Scala / Wrapping和Braces中检查“一行中的简单方法”选项: enter image description here