Table of content
WholeTomato

VA Snippet Editor for VS2010 and Newer

Visual Assist installs with two VA Snippet editors, the newer of which is available in Visual Studio 2010 and newer IDEs. You can use the editor to create, modify, and delete VA Snippets.

Access

Explore the ways you can reach the VA Snippet editor, and which editor you should use.

Language

Visual Assist maintains separate VA Snippets for separate programming languages. VA Snippets for all languages can be accessed any time the editor is open. Each time you open the editor, be sure the Language drop-down is set to the value you expect.

When opening the VA Snippet editor from the context menu of the text editor, the context in the editor is set to the programming language of the active document.

You must recreate VA Snippets you want to use in multiple languages.

Type

The Type drop-down restricts the visible list of VA Snippets to a related set.

The two "All" types include all VA Snippets, except those for Smart Suggestions and Refactoring.

When type is "All by Title", VA Snippets are sorted by calculated title—explicit titles or the first parts of code to be expanded.

In the following example, the title for shortcut "#im" is calculated from code to be expanded. 

When type is "All by Shortcut", VA Snippets with shortcuts are sorted before those without shortcuts.

A VA Snippet may be visible for multiple values of the Type drop-down. For example, a VA Snippet with a shortcut that includes $selected$ appears in the list when type is "All by Shortcut" and when type is "Surround With".

Search

When the Type drop-down is set to "Search", you can locate VA Snippets by substring. The result set includes VA Snippets from all types, including Refactoring.

Search by regular expression to isolate VA Snippets by more than substring.

Select from built-in expressions that find VA Snippets with comments, environment variables, quoted strings, etc, or use the RE builder menu to create a regular expression.

Toolbar

The buttons in the toolbars of the editor operate at the level of VA Snippet, and are enabled only when the buttons apply to the current value in the Type drop-down. For example, "New" is enabled when Type is "All by Title", but disabled when Type is "Refactoring".

NB. The key binding to create a new VA Snippet in Ctrl+N, whereas it was Ctrl+I in the old editor. The change in binding makes it possible to create a new VA Snippet when focus is anywhere in the editor. (Ctrl+I remains the key binding to insert a reserved string, which is operable only when focus is in the code field.)

Copy to XML

When you copy a VA Snippet—not just its code—Visual Assist places an XML version of the VA Snippet in the clipboard.

You can paste the XML into the list of VA Snippets, e.g. paste it to another programming language, or paste it into an external editor. You can paste externally modified XML back into the VA Snippet editor.

You can copy one or multiple VA Snippets in a single operation, making it easy to copy a suite of VA Snippets from one programming language to another.

Preview Input Dialog

In many cases, VA Snippets with input placeholders prompt for input directly in the editor. In other cases, the same VA Snippets prompt via dialog. You may preview the input dialog of any VA Snippet that includes input placeholders.

Toolbar for Code

The secondary toolbar is available when editing code for a VA Snippet.

Commands in the secondary toolbar are available to:

  • Insert a reserved string
  • Undo and redo edits
  • Toggle line numbers
  • Toggle an indicator at the column specified in the options dialog for Visual Assist
  • Toggle unprintable characters
  • Toggle word wrapping

Modified Status

VA Snippets modified since the editor was opened are offset in red.

Keyboard Access

The entire interface of the VA Snippet editor is accessible via keyboard, either via key bindings or context menus.

Shortcut Description
Ctrl+N Create new VA Snippet
Ctrl+P Preview input dialog (when appropriate)
Ctrl+Alt+Up Move horizontal splitter up
Ctrl+Alt+Down Move horizontal splitter down
Ctrl+Alt+Left Move vertical splitter left
Ctrl+Alt+Right Move vertical splitter right

Shortcut
in list of
VA Snippets

Description
Delete Delete VA Snippet
Ctrl+C Copy VA Snippet
Ctrl+V Paste VA Snippet
Ctrl+X Cut VA Snippet

Shortcut
in code

Description
Ctrl+I Insert reserved word
Ctrl+Shift+I Overwrite reserved word under the caret
Ctrl+C Copy
Ctrl+V Paste
Ctrl+X Cut
Ctrl+A Select all
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+Shift+L Toggle line numbers
Ctrl+Shift+C Toggle column indicator
Ctrl+Shift+U Toggle unprintable characters
Ctrl+Shift+W Toggle word wrapping