Wiki

Case Status
Log In

Wiki

 
Whole Tomato Software - Home
  • RSS Feed

Add/Remove Braces

Add Braces and Remove Braces commands simplify the process of converting a statement to a compound statement, and vice versa. From anywhere within a simple statement, you can easily add braces. From anywhere in a "compound" statement that contains only a single statement, you can easily remove the unnecessary braces.

Add Braces and Remove Braces are available after most programming constructs, e.g. if, else, for, and while, and at any level of nested statements.

Access

You can access Add Braces and Remove Braces in several manners.

The commands appear in the Quick Action and Refactoring menu (Shift+Alt+Q) when appropriate.

The commands are also available for key binding. In addition to adding and removing of braces, you can toggle braces via binding of a shortcut to VAssistX.BracesToggle. The toggle will remove braces if they exist, and add braces if they don't.

Finally, the commands are available via menus. First, in the VAssistX entry of the menubar.

And, in the context menu (Shift+Right Click) of the text editor.

Location of Opening Brace

You can specify the location of opening braces in the options dialog for Visual Assist.

Limitation to Single Statements

To prevent breaking of code, Add Braces is limited to single statements. The command is not available to place braces around statements even if they are indented to the same level.

Similarly, Remove Braces is available only in "compound" statements that contain a single statement. Remove Braces is not available when a compound statement contains multiple statements.

Caution

Remove Braces is available when braces surround a single "statement" at the source level. If the single "statement" invokes a pre-processor macro that expands to multiple statements, removal of the braces will change the behavior of your code.

Hence, you should remove braces only when certain removal is safe.