Table of content
WholeTomato

VA Snippets Create from Selection

You can create a new VA Snippet using an existing fragment of code. You can initiate the creation in either of two ways.

Highlight a fragment, and then select VAssistX | Tools | Create VA Snippet from selection.

Or, highlight a fragment; open VAssistX | Insert VA Snippet; and then select Create VA Snippet from selection.

    

The VA Snippet editor opens with your fragment in a new VA Snippet. Modify the VA Snippet as necessary, including updating of title and shortcut, and replacing of constants and symbol names with placeholders.

Example

Manage pointer types using the Resource-Acquisition-Is-Initialization (RAII) programming idiom and a VA Snippet. Select the following lines you might have for an existing pointer.

Select VAssistX | Insert VA Snippet | Create VA Snippet from selection...

The VA Snippet editor opens.

Update title, shortcut, and description.

Replace symbol names in code with input placeholders: $name$ and $type$. Position caret after expansion with $end$.

Exit the VA Snippet editor, saving your changes.

In the text editor, type your shortcut and accept the suggested VA Snippet.

Enter a type and name in the dialog.

Accept the dialog and confirm VA Snippet expanded as you expected.