Smart Select commands simplify the process of selecting common blocks of code. From the current selection or caret position, you can easily select the encompassing block, expand the selection to a larger block, or shrink the selection to a narrower one. Visual Assist extends and shrinks only to common blocks so the process of selecting requires few, if more than one, keystroke.
Primary access to the Smart Select commands is via keyboard shortcuts assigned during installation of Visual Assist.
For mouse users, access is available in the VAssistX menu.
Extend Block Selection
An initial selection using Extend Block Selection (Alt+]) is either the current statement or innermost block of code containing the caret. Blocks beyond the current statement are typically logical groups of them, e.g. all statements that comprise a method, or compounds statements—including their conditions and guards.
If you initiate Extend Block Selection when the caret is within a line, e.g. after the 'f' of "if", the initial selection is comprised of entires lines.
If you initiate Extend Block Selection when the caret is before the first non-whitespace character of a block, e.g. before the 'i' of "if", the initial selection is trimmed.
Successive presses of Extend Block Selection cause encompassing blocks to be selected.
Alternatively, initial selections can be made with Extend Selection (Shift+Alt+]), which causes less code to be selected.
Successive presses of Extend Selection cause the selection to grow by small increments.
Extend Selection often follows Extend Block Selection to make a small increase to a large selection, e.g. to select braces of a compound statement but not its condition or loop statement.
If you initiate Extend Selection when the caret is in the leading white space of a line, the first word or entire line is selected, including the white space.
If you initiate Extend Selection inside a line, successive extends will select a trimmed version.
Shrink Block Selection
Once a selection has been made, Shrink Block Selection (Alt+[) will decrease the selection by a large increment.
With a selection made—by any means—Shrink Selection (Shift+Alt+[) will decrease the selection by a small increment.
Shrink Selection often follows Extend Block Selection to make a small decrease to a large block selection, e.g. to omit a condition or loop statement from a compound statement.
Extend Selection in Comments and Strings
Extend Selection and Shrink Selection work well within comments and strings.
Note: The block variants—Extend Block Selection and Shrink Block Selection—continue to operate at the block level when executed in comments and strings.
Extend to Start of Selection
A selection is scrolled into view as it grows. If a selection grows beyond the height of the text editor, a small window opens briefly to identify the start of the selection.
Adjust Size of Selections
All four of the Smart Select commands—extend and shrink by block and non-block—create initial selections. Successive executions of the commands grow and shrink a selection by additional elements. You can adjust the size of the initial selections and the granularity of subsequent changes in the options dialog for Visual Assist.
Start and grow selections by relatively small increments
When checked, if you begin a selection with non-block extend (Shift+Alt+]) or non-block shrink (Shift+Alt+[), the first selection is the current word or logical element and successive executions grow/shrink the selection by small, logical elements—until the current statement is selected.
If you begin a selection with block extend (Alt+]) or block shrink (Alt+[), the first selection is the current statement and successive executions grow/shrink the selection by blocks.
When unchecked, if you begin a selection with non-block extend (Shift+Alt+]) or non-block shrink (Shift+Alt+[), the first selection is the current word or logical element and the next selection is the current statement. If you begin a selection with block extend (Alt+]) or block shrink (Alt+[), the first selection is the current block.
Start non-block selections with the current word
When checked, the non-block extend (Shift+Alt+]) and shrink (Shift+Alt+[) commands begin every selection with the current word.
When unchecked, the commands choose an initial selection based on caret location and context. (The setting does not affect the block commands.)
Changes in case delimit current word
When checked, changes in case delimit the current word. (The setting is effective only if non-block selections start with the current word.)
Underscore delimit the current word
When checked, underscores delimit the current word. (The setting is effective only if non-block selections start with the current word.)
|SmartSelectExtend||Select or increase by a small increment||Shift+Alt+] †|
|SmartSelectExtendBlock||Select or increase by a smart block||Alt+]|
|SmartSelectShrink||Decrease by a small increment||Shift+Alt+[ †|
|SmartSelectShrinkBlock||Decrease by a smart block||Alt+[|
† In Visual Studio 2017 15.9 and newer, shortcut is assigned when accepting recommendations.
Visual C++ 6.0
Smart Select is not available.