Use outlining to hide code fragments with which you are not working and to display only those fragments that you need now. Therefore, outlining serves for better organization, structuring and readability of your code.
By default, TestComplete automatically combines routines and multi-line comments into blocks, which you can then expand or collapse. You can disable automatic outlining and manually define outlining of any code fragments.
When a block is collapsed, the Code Editor shows only the first line of this block followed by the icon. When the block is expanded, you can see all of the source lines that make up the block.
The following figure displays code in the Editor with and without outlining:
Outlined code is not deleted, it is hidden from view. Outline blocks can be nested. That is, each block can hold script code lines and other blocks (see the figure above).
The outlining settings are stored in the configuration file of your TestComplete project on your computer. They will remain if you close the project and reopen it later. Users working with the project on the same computer will have individual outlining settings.
To Collapse a Block
To collapse the block, do any of the following:
- Click the minus sign in the gutter on the left of the block,
– or –
- Right-click the first line of the block and choose Outlining | Collapse Block from the context menu,
– or –
- Press the Alt+Left shortcut.
To collapse all blocks:
- Select Outlining | Collapse All from the context menu,
– or –
- Press the Ctrl+Alt+C shortcut.
To Expand a Block
To expand the block, do any of the following:
- Click the plus sign in the gutter on the left of the block,
– or –
- Right-click the first line of the block and choose Outlining | Expand Block from the context menu,
– or –
- Press the Alt+Right shortcut.
To expand all blocks:
- Select Outlining | Expand All from the context menu,
– or –
- Press the Ctrl+Alt+A shortcut.
To Outline a Block Manually
Right-click anywhere in the Code Editor and then click Outlining | Stop Automatic Outlining.
Use the mouse or Shift+<Arrow keys> to select code lines that will make up this block.
Click the Hide Selected Lines button on the Code Editor’s toolbar.
– or –
Right-click anywhere in the Code Editor and then click Outlining | Hide Selection.
The Outlining | Hide by Definitions item of the context menu makes blocks from the selected functions and procedures. That is, every routine whose lines are selected will become a block. Use it to quickly organize your routines into blocks. When performing the “Hide by Definitions” operation, TestComplete removes all blocks that belong to the selection (it removes even partially selected blocks), so that after the operation is over, you get blocks based on functions and procedures only. If there is no selected lines in the Editor, TestComplete will outline all the routines of the current unit.
To View a Collapsed Block
To quick view the collapsed block’s content, place the cursor on the icon near the desired block. A popup window with the collapsed text will appear.
To Find or Replace Text in Collapsed Blocks
Select the Search in collapsed sections check box.
Configure other search or replace parameters. (See the description of the Find dialog and the Replace dialog correspondingly.)
The dialog will search for the specified text within the specified scope including collapsed code blocks.
To Cancel the Outlining of a Block
Place the cursor within the desired block.
Click the Stop Hiding Current Block or Selected Lines button on the Code Editor’s toolbar.
– or –
Select Outlining | Stop Hiding Current from the Editor context menu.
This command is applied to every block whose lines are selected (even to partially selected blocks). If there is no selection, the command is applied to the block that is holding the caret.
To Cancel the Outlining or a Unit
Right-click anywhere in the Code Editor and select Outlining | Stop Outlining from the context menu.
TestComplete will expand all collapsed blocks in the current script unit and remove the outlining markup from the gutter.
To Disable Outlining
To enable or disable automatic outlining, open the Code Editor | Display page of the Options dialog and select (or clear) the Automatic Outlining check box.
To enable or disable outlining for all code, on the Code Editor | Display page of the Options dialog, select (or clear) the Outlining check box.