Search code examples
javaintellij-ideacode-folding

IntelliJ IDEA Code Folding


I started using IntelliJ IDEA to write Java, and one thing kinda annoys me. When I fold a one-line method, it looks like this:

Screenshot 1.

Is there any way to make it look like this?

Screenshot 2


Solution

  • Settings -> Editor -> General -> Code Folding. There is an entry 'One-line methods', which is marked by default. You can uncheck this checkbox to get rid of inconvenient code folding. There are shortcuts for folding/unfolding single method by combination Ctrl + '-'/Ctrl + '+', or all methods in a file by combinations Ctrl + Shift + '-'/Ctrl + Shift + '+'