Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ collapsing single line methods

Since I've updated my version of intelliJ (14.x to 15.x) it has started automatically collapsing single line methods in the Java editor:

Previous version:

public void setContext(SecurityContext context) {     this.context = context; } 

Latest version:

public void setContext(SecurityContext context) { this.context = context; } 

Is there a way to prevent this? I find the original version much easier on the eyes!

Thanks.

like image 805
StuPointerException Avatar asked Mar 14 '16 18:03

StuPointerException


People also ask

How do I collapse a method in IntelliJ?

To collapse or expand all code fragments, press Ctrl+Shift+NumPad - / Ctrl+Shift+NumPad + . IntelliJ IDEA collapses or expands all fragments within the selection, or, if nothing is selected, all fragments in the current file, for example, all methods in a file.

How do you remove code folding?

Go to File -> Settings -> Editor -> General -> Code FoldingUncheck Show code folding outline.

How do I collapse a folder in IntelliJ?

The action is called Collapse All and the default shortcut is Ctrl + NumPad - on Windows and Cmd + - on Mac (the project view has to be focused).

How do I format multiple lines in IntelliJ?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. Switch to the Formatter tab and in the Do not format field, enter the files and directories that you want to exclude using a glob pattern. , the field will expand, and each pattern will be shown on a separate line.


2 Answers

Open 'Settings' from the File menu. Under 'Editor' -> 'General' -> 'Code Folding', you will find a 'Collapse by Default' section.

Simply uncheck 'One-line methods' and click OK.

like image 130
rmlan Avatar answered Sep 17 '22 07:09

rmlan


On Windows:

Settings -> Editor -> General -> Code Folding -> Uncheck "One-line methods"

like image 23
ToDo Avatar answered Sep 18 '22 07:09

ToDo