VA Snippets can include placeholders that prompt for user input when a VA Snippet is invoked. Input placeholders can have initial values, and all occurrences of a single input placeholder in a VA Snippet are expanded with a single value obtained from the user.
Like reserved strings, input placeholders are enclosed in dollar signs. Any string in a VA Snippet within dollar signs that is not a reserved string is an input placeholder. A maximum of eight input placeholders can be included in any one VA Snippet.
In the following example, the default VA Snippet for a simple for() loop includes two input placeholders.
VA Snippets with input placeholders are expanded using in-line prompts or input dialogs.
If you anticipate input requirements of a VA Snippet and have the input value(s) in your clipboard, paste them into an in-line prompt or input dialog.
In most cases, VA Snippets with input placeholders are expanded in-line, i.e., within the text editor. Enter values and tab among fields. When done, press Enter to commit the VA Snippet.
If a VA Snippet cannot be expanded in-line, Visual Assist prompts for input placeholders via a dialog.
Input dialogs appear when:
- a VA Snippet ends with an input placeholder
- a case variant, e.g., Upper, is applied to an input placeholder
- a VA Snippet is invoked when entering values for another
Input placeholders are case sensitive, so a VA Snippet that includes $Author$ and $author$ will prompt for both values.
Input placeholders can have default values, specified in the following format:
Do not surround default values with quotes or spaces.
In the following example, the VA Snippet was modified to include the default value "i" for Index.
Environment placeholders may be used as default values.
If an input placeholder appears multiple times in a VA Snippet, provide a default value with one instance only.
Modification of Input
Include a modifier to an input placeholder if you wish to adjust user input. Specify a modifier according to the following format:
|Upper||Convert to uppercase|
|Lower||Convert to lowercase|
|Pascal||Convert first character to uppercase|
|Camel||Convert first character to lowercase|
In the following example, the VA Snippet includes an input placeholder, modifier, and default value.
Modifiers are case sensitive, and work with input placeholders and some VA Snippet Reserved Strings. You cannot use the modifiers with environment placeholders.