Test Design StudioGo to Previous Topic: Code SnippetsGo to Next Topic: XML Comments

Outlining (Code Folding)

Outlining allows you to temporarily collapse or hide regions of text that you do not need to see.

When outlining is present for an item, there will be a [+] or [-] symbol in the left margin. Clicking the [-] symbol will collapse the region and display text in the editor to indicate what was collapsed. Clicking the [+] symbol will expand that region for you to see the full code.

When a region is collapsed, you can hover your mouse over the collapsed region text to see a tooltip of the text that is contained within that region. Double-clicking the collapsed region text will cause the region to automatically expand.

Automatic Outlining

By default, Automatic Outlining is enabled for all supported editors. When Automatic Outlining is on, the following items are automatically set up for outlining:

The following editors currently support automatic outlining:

Region Markers

You can mark any region of text for automatic outlining. The markers vary based on the language. Sample region markers:

[VBScript] - Copy Code
'Region {Optional Region Title}
    ' {Code to be included in the region}
'End Region
[JScript] - Copy Code
//region {Optional Region Title}
    // {Code to be included in the region}
//endregion

These regions are automatically set up for collapsible text when automatic outlining is enabled. When you collapse the region, the collapsed text will display ... if you did not provide a title or, if you entered a title to the right of the beginning region marker, the supplied title will be displayed instead.

The following shows a region of VBScript text outlined using Region markers:

The following shows the same region of text after it has been collapsed:

Manual Outlining

If you prefer, you can manually define the regions of text that you want to be included in outlining. To do so, you must turn off Automatic Outlining by executing the Stop Outlining command. This will remove all outlining in the document and prevent automatic outlined regions from appearing.

You can now define any region of text to be outlined. Simply highlight the range of text you want to outline and execute the Hide Selection command. You can stop outlining that selection by placing your caret within or immediately next to the outlined area of text and executing the Stop Hiding Current command.

You turn Automatic Outlining back on by executing the Start Automatic Outlining command.

Outlining Commands

Outlining commands are available from the main menu by selecting Edit -> Outlining while a document is open. Outlining commands are also available by right-clicking the text of a document.

The following commands are available for outlining (some commands are only available for specific outlining modes):

Command Description
Toggle Outlining Expansion Toggles the expansion state of the closest outlining area based on the current location of the caret.
Toggle All Outlining Toggles the expansion state of all outlining areas. The outlining area closest to the current location of the caret will determine if other areas are expanded or collapsed.
Collapse to Definitions Turns on Automatic Outlining (if not already active) and automatically collapses most outlining regions defined by Automatic Outlining.
Stop Outlining [Automatic Outlining Only] Turns off Automatic Outlining and enabled Manual Outlining.
Hide Selection [Manual Outlining Only] If a range of text is selected, this option will define an outlining area to encompass that selection.
Stop Hiding Current [Manual Outlining Only] The outlining area closest to the current location of the caret will be removed.
Start Automatic Outlining [Manual Outlining Only] Turns on Automatic Outlining. All manually defined outlining regions will be removed when you switch from Manual Outlining to Automatic Outlining.