Smart Suggestions are highly context-aware code hints that speed development by suggesting text you're likely to type in the current context. With Smart Suggestions, C++ users enjoy C#-like autocompletion for several common scenarios.
Constructors are suggested for assignment to a pointer of that type, providing a significant reduction in typing.
Enum Assignment and Comparison
Assigning or comparing enums, including switch statement constants, will populate the suggestion list with the enum values.
Parameter Type Matching
When invoking a function or method, Visual Assist X notes the expected parameter types and suggests local variables with matching types. Click the link below the example for a demonstration.
Suggestions for Type
You can define a set of Smart Suggestions to use when assigning or comparing built-in or user-defined types. For instance, when working with HRESULTs, Visual Assist X suggests S_OK and S_FALSE by default. You can add your own commonly used HRESULTs to this list by modifying the VA Snippet
"SuggestionsForType HRESULT". Other built-in types Visual Assist X supports out of the box are bool, BOOL, Boolean, and VARIANT_BOOL.
Additionally, you may specify a set of values to suggest for other types (both built-in and user-defined types are supported). This is achieved by creating a VA Snippet titled "SuggestionsForType <typename>". In the example below, a set of severity values is defined.
In this example, typing code that assigns or compares a SEVERITY variable displays the user-defined Smart Suggestion list.
Note that Visual Assist X is simply inserting the text from the list you create, and has no awareness of the underlying meaning of that text (it may be a macro, string literal, number, etc.) In the example above, the SEVERITY values must be defined somewhere in your code, such as a company-wide standard header file.
Visual Assist X suggests different items depending on your context. For instance, if you are defining a class, you'll see different suggestions than if you were typing in a method body. These suggestions are controlled by the various SuggestionsForType VA Snippets, using the special terms loop
, and class
instead of true type names:
|VA Snippet||Context||C++ defaults||C# defaults||VB defaults|
|SuggestionsForType loop||Within a loop control structure||continue;|
|SuggestionsForType switch||Within a switch statement||case|
|SuggestionsForType class||Within a class definition||public:|
Smart Suggestions may be completed with the Tab key regardless of the "Selections committed with" settings under VA Options | Advanced | Listboxes.