Search Results

    loading table of contents...

    Simple but valuable commands make it easy to surround selections with comment characters, parentheses, braces, #ifdef - for C/C++ users. Commenting style is sensitive to the language.

    For example in C/C++, make a selection and type / to begin each line of the selection with //. Type * to surround the selection with /* and */. Type the characters again to eliminate the comment characters.

    Start with this selection:

    Type / and get a line-commented version:

    Or type * to get a block-commented version:

    The text selection remains so you can uncomment, select more lines, and comment again quickly if necessary. Similar behavior occurs for the ( and { characters, while the # character behaves differently for each language:

    Language Surrounding text
    C++#ifdef ... #endif
    XML!<-- ... -->
    AVR Assembler#Region "" ... #End Region

    Commenting Smaller Selections

    Select one or more symbols on a line and press / to comment the small selection. Instead of // at the front of a line, your small selection is surrounded by /* and */. Identical behavior occurs when you press *.

    Commenting Existing Comments

    Pressing / when one or more lines are selected comments when columns one and two of the first line do not contain //. Uncommenting occurs only when // appears at the beginning of the first line. This rule exists to accommodate commenting and uncommenting of blocks of code containing comments.

    Parentheses

    Press ( to surround a selection with parentheses. Press ( again to add another pair. Press Undo to revert the operation.

    Braces

    Press { to surround a selection with braces and indent the selection. The command works best on single or multiple line selections, not on small selections. The Format Selection command of the IDE is run automatically on the new selection. Press Undo to revert the formatting; press Undo a second time to eliminate the braces.

    #ifdef and #endif

    For C/C++, press # to surround a selection with #ifdef and #endif. Select one or more lines before pressing #.

    Specify the default value for the #ifdef in the VA Snippets Editor.

    Regions

    For C#, press # to surround a selection with #region and #endregion. VB code is surrounded with #Region "" and #End Region. Select one or more lines before pressing #.

    After the surround operation has been performed, the text caret is automatically placed where the region name should be typed.

    Text formatting and caret placement are specified using the VA Snippets Editor.