WebStorm 9.0.2 Web Help

Code Folding

Code folding lets you collapse (fold) code blocks, reducing them to a single visible line. In this way, you can hide the details that, at the moment, seem unimportant. If and when necessary, the folded code blocks can be expanded (unfolded).

Folded code blocks are shown as shaded ellipses.

You can fold (collapse) and unfold (expand) code blocks by using:

  • Code folding toggles (foldingMinusStart, foldingMinusEnd or foldingPlus). These toggles are shown in the editor on the left of the corresponding blocks. If a block is unfolded, foldingMinusStart indicates the beginning of the block while foldingMinusEnd is located at its end. For folded blocks, the toggle is shown as foldingPlus.
  • Commands of the Folding menu. The Folding menu can be accessed from the main menu bar ( Code | Folding ), or as a context menu in the editor.
  • Keyboard shortcuts. The corresponding shortcuts are shown in the Folding menu.

Folding menu

Item Shortcut Description
Expand Ctrl+NumPad+ Expand the current code block
Collapse Ctrl+NumPad - Collapse the current code block
9.0+ Expand Recursively Ctrl+Alt+NumPad+ Expand all sub-blocks within the current code block
9.0+ Collapse Recursively Ctrl+Alt+NumPad - Collapse all sub-blocks within the current code block
Expand All Ctrl+Shift+NumPad+ Expand all code blocks in the selected area, or in the current file if no area is selected
Collapse All Ctrl+Shift+NumPad - Collapse all code blocks in the selected area, or in the current file if no area is selected
9.0+ Expand to level Ctrl+NumPad *, 1
Ctrl+NumPad *, 2
Ctrl+NumPad *, 3
Ctrl+NumPad *, 4
Ctrl+NumPad *, 5
Expand the selected code block to a certain level
9.0+ Expand all to level Ctrl+Shift+NumPad *, 1
Ctrl+Shift+NumPad *, 2
Ctrl+Shift+NumPad *, 3
Ctrl+Shift+NumPad *, 4
Ctrl+Shift+NumPad *, 5
Expand all code blocks in the current file to a certain level
Expand doc comments N/A Expand all documentation comments in the current file
Collapse doc comments N/A Collapse all documentation comments in the current file
Fold Selection / Remove region Ctrl+Period Collapse the selected fragment / Expand the selected fragment and make it "unfoldable"

In this section:

See Also

Last modified: 11 December 2014
comments powered by Disqus