Table of content
WholeTomato

VA Snippets with Shortcuts

VA Snippets with shortcuts let you quickly insert commonly used fragments of code in your source. These VA Snippets appear in completion lists as you type. If you have multiple VA Snippets with the same shortcut, all are included in the completion list when you type the shortcut.

In the following example, two VA Snippets appear when shortcut "class" is typed.

The expanded code of a VA Snippet can include context-specific values such as a GUID, date, and time.

After you accept a VA Snippet, Visual Assist inserts expanded code in place of the shortcut.

Enabling VA Snippets with Shortcuts

Including VA Snippets in completion lists requires enabling of the feature in the options dialog of Visual Assist.

Disabling Built-In Snippets

Visual Studio 2012 and newer

If you use VA Snippets, you can disable built-in snippets to avoid redundant entries in completion listboxes. In the IDE, disable:

Tools | Options | Text Editor | C/C++ | Advanced | Intellisense | Disable Member List Code Snippets

Title

VA Snippets with shortcuts may or may not include titles. If a title exists, the title appears in the completion list when the shortcut is typed.

If a VA Snippet does not have a title, the first part of the code to be expanded appears. 

Typically, VA Snippets with shortcuts that expand to very short fragments of code do not have titles.

VA Snippets that share a common shortcut should have unique titles, making it easier to differentiate entries in a completion listbox.

If duplicate shortcut-title pairs exist, only one of the associated VA Snippets will appear in a completion list.

Case Sensitivity

Shortcuts for VA Snippets are case sensitive. A VA Snippet with shortcut lowercase 'w' will not appear in a completion list if you type uppercase 'W'. If you want 'w' and 'W' to expand to the same code, you must create two VA Snippets.