Outlining and Hiding Code

Microsoft Script Editor

Outlining and Hiding Code

The Microsoft Script Editor offers you the option of creating a hierarchical, outlined overview that gives you a big-picture view of the overall structure of your document.

Outlining code

You can select a region of code (that is, a selected block of text) and hide (or collapse) it so that it appears under a symbol. You can then expand or hide the region by clicking the plus sign (+) next to the symbol. Outlined code is not deleted, it is merely hidden from view.

You can create nested regions of outlining so that you might expand one section that contains one or more subsections of collapsed text.

After outlining code, you can expand only the sections you want to work on, collapse them when you’re done, and then move to another section. When you are through outlining, you can use the Stop Outlining command to remove the outline information without disturbing your underlying code.

Caution   Outlining information in a region is lost if you make changes to that region, such as by deleting horizontal whitespace or by using a find and replace operation.

On the Outlining submenu (Edit menu) there are always five different commands available:

  • Hide Selection    Hides the currently selected text. Text must be selected for this command to be enabled.
  • Toggle Outlining Expansion    Reverses the current hidden or expanded state of the innermost outlining section in which the cursor lies when you are in a nested collapsed section.
  • Toggle All Outlining    Sets all procedures to the same hidden or expanded state. If some regions are expanded and some hidden, then all regions are hidden.
  • Stop Outlining     Removes all outlining information for the entire document. All procedures are visible and the symbols removed, but the underlying code is undisturbed.
  • Stop Hiding Current    Removes the outlining information for the currently selected user-defined region.

To create and hide a region

  1. Select the text you want to hide.
  2. On the Outlining submenu (Edit menu), click Hide Selection.

You can repeat this process several times and then use the Toggle Outlining Expansion and Toggle All Outlining commands to hide them or make them visible.

To stop outlining a specific outlined section of text

  • On the Outlining submenu (Edit menu), click Stop Hiding Current. This removes the user-defined region but does not disturb the text.

To stop outlining in an entire document

  • On the Outlining submenu (Edit menu), click Stop Outlining. All outlining information is discarded.

Expanding and collapsing regions

To expand or collapse a previously created region

  1. Put the cursor on the hidden region.
  2. On the Outlining submenu (Edit menu), click Toggle Outlining Expansion, or press CTRL+M twice. Alternatively, you can click the plus sign (+) or minus sign (-) to the left of the region. Another way to expand a previously created region is to double-click the ellipsis symbol (...).

The Undo and Redo commands on the Edit menu affect these actions. In other words, if you create a hidden region, clicking Undo reverses that action. Also, cut, paste and drag-and-drop operations retain the hidden regions and the outline information.

Script-only view

In the Script Editor, you can activate a Script-Only view in which only script blocks are displayed.

To enable script-only view

  1. Open the HTML document.
  2. In the upper right corner of the document, click Script Only View.
  3. To return to the default view, click Full HTML View .