Skip to content

Expand/collapse

If a source file is long, it is useful to divide it into collapsible regions. By collapsing the regions and putting a comment before them, you have a compact view of the code—a kind of table of contents—that gives an idea of what it does without having to read it all.

Studio automatically recognizes blocks of code as regions you can collapse and expand.

To collapse a region, select one of the icons with the minus sign on the edge of the gutter.

To expand a collapsed region:

  • Select the plus sign icon on the edge of the gutter.

Or:

  • Select the text representing the collapsed region. It can be an ellipsis (see below).

To view the contents of the collapsed region without expanding it, hover over the line representing the collapsed region or the ellipsis.

In addition to automatically determined regions, you can create custom regions.

To create a collapsible region or remove an existing region:

  1. Select the code portion:

  2. Right-click the selection and choose Folding > Fold Selection / Remove region.

Expansion and collapse commands are also available in the context menu.

To manage code folding parameters select File > Settings > Editor > General > Code Folding on the main menu.