Code Outlining

The Code Outlining feature helps you to work on only the necessary part of a code without being distracted to other functionality blocks. This option automatically divides your code into separate code blocks between methods, tags, etc. and gives you the ability to selectively hide the parts of a code that you don't need right now.

Collapsing code

In the editor next to the line number, you can see the Code Outlining tool — a vertical line with a 'minus' on it. Hover a cursor on it, and you will see a code block that can be collapsed: a part of the code is highlighted. By default, the highlighting color is grey, but you can change in the Options menu: Main Menu ⇒ Tools ⇒ Options ⇒ Environment ⇒ Fonts and Colors ⇒ Collapsible Region.


Code outlining highlighting


You can collapse a code block in three different ways:

  • double-click on a highlighted part of the Code Outlining tool,
  • click on a 'minus' on the code outlining tool,
  • place a cursor in a necessary code block and press the Ctrl+M+M hotkey.

The selected code block will be collapsed and instead of it, you will see . Hover a cursor on it, and you will see the hidden code block.


The hidden code block


When you want to open a collapsed block, just do one of the actions mentioned above one more time.

The Code Outlining tool also recognizes multiline comments. You can collapse comments in a code by the same methods. The selected code block will be collapsed and instead of it, you will see the /* multiline comment */ tooltip. Hover a cursor on it, and you will see the hidden block.

Code Outlining options

All the options related to the Code Outlining functionality can be found in the Main Menu: Edit ⇒ Outlining.


Code Outlining options from the Main Menu


Hide Selection Ctrl+M, H Collapses a selected block of a code that usually isn't available for outlining.
Toggle Outlining Expansion Ctrl+M, M Collapses / expands the selected code block.
Toggle All Outlining Ctrl+M, L Sets all the blocks to the same state as the selected.
Stop Outlining Ctrl+M, P Removes all outlining information for the entire document.
Stop Hiding Current Ctrl+M, U Removes the outlining information for the currently selected code block.
Collapse to Definitions Ctrl+M, O Collapses the members of all types.

The Code Outlining feature is available within Apex, CSS, HTML, Lightning, Visualforce, and XML editors.

In this section:

This also may be useful:

Last modified: 2017/08/16 14:42

footer image