IntelliJ IDEA one-line function formatting

https://stackoverflow.com/questions/36294708/intellij-idea-one-line-function-formatting

 

65

IntelliJ keeps formatting this:

public void addElement(Element elem) {
    this.elements.add(elem);
}

into this:

public void addElement(Element elem) { this.elements.add(elem); }

I prefer the multi-line formatting. How can I tell this to IntelliJ? I have unchecked the following boxes in Settings -> Editor -> Java -> Wrapping and Braces

  • Control statements in one line
  • Simple blocks in one line
  • Simple methods in one line

Didn't help.

2 Answers

92
 

Look in Preferences (or Settings), Editor, General, Code Folding, Collapse by default, One-line methods

enter image description here

 
posted @ 2021-11-04 07:31  功夫 熊猫  阅读(104)  评论(0编辑  收藏  举报