A custom folding region for a selection is created and removed by means of the Code | Folding | Fold Selection/ Remove Region command Ctrl+.Ĭode folding works for the keywords if/ while/ else/ for/ try/ except/ finally/ with in case of at least two statements. The predefined regions, roughly, correspond to the ones listed under Collapse by default on the Editor | General | Code Folding page of the IDE settings Ctrl+Alt+S.įor the predefined regions, the folding toggles are available right away, without the need to perform any additional actions.Īny selected code fragment. Predefined regions that correspond import declarations, method bodies, classes, documentation comments, etc.
See Commands of the Folding menu and associated shortcuts.įolded fragments themselves: click to expand the corresponding fragment. The shortcuts are shown right in the menu. The Folding menu can be accessed from the main menu ( Code | Folding), or as a context menu in the editor. If you hold the Alt key and click, or, the region is collapsed or expanded recursively, for example along with all its subordinate regions.Ĭommands of the Folding menu and associated keyboard shortcuts. For folded regions, the toggle is shown as. If a region is unfolded, indicates the beginning of the region while is located at its end. These toggles are shown in the editor to the left of the corresponding folding regions.
You can collapse and expand code fragments by using:Ĭode folding toggles (, or ).
To extend the editor area, you can hide all tool windows by pressing Ctrl+Shift+F12 or by double-clicking the current editor tab, or you can hide all IDE elements in the Zen Mode by choosing View | Appearance | Toggle Zen mode from the menu. If the folded code block contains errors, JetBrains Rider highlights the folded fragment in red. If and when necessary, the folded code fragments can be expanded (unfolded).įolded code fragments, normally, are shown as shaded ellipses ( ). In this way, you can hide the details that, at the moment, seem unimportant. You can collapse (fold) code fragments reducing them to a single visible line.