IntelliJ IDEA allows displaying source code in a folded form, making it really concise, and hiding from view the details you might consider less important. When a file is first opened for editing, certain code constructs can be shown folded. It is up to you to define the desired set of code constructs to be folded by default. So doing, when you hover your mouse pointer over the collapsed code fragment, its preview is displayed in a pop-up window.
IntelliJ IDEA can also fold lines in consoles. This lets you hide extraneous information and make console output easier to read and comprehend.
Now, when you first open files for editing, the selected code constructs will be shown as shaded brief information, with the preview available at the mouse pointer.
For example, you can automatically hide imports:
I18N support is enhanced with the special folding that allows you to hide method calls, retrieving properties from resource bundles and replace them with actual property values:
Anonymous classes can be presented in a concise way, as shown below:
- Open the IDE Settings and click Console Folding. The Console Folding page is displayed.
- In the Fold console lines that contain area, configure a list of patterns that determine the lines to be always folded in console output. Use ( or or or or ), ( ) or ( ) to create, edit or remove the patterns.
- In the Exceptions area, configure a list of patterns that determine the lines that never should be folded in console output. Use ( or or or or ), ( ) or ( ) to create, edit or remove the patterns.
- In the console output, select the relevant line.
- On the context menu, choose Fold lines like this.
- In the Console Folding dialog box that opens, the selected line is added to the Fold console lines that contain list. Click OK to have the line added to the list as is. To edit the new pattern, select it, click ( ), and update the character string as necessary in the Folding Pattern dialog box that opens.