Smart Suggestions

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.

Pointer Assignment

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.



Animate example

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.

Special Contexts

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, switch, and class instead of true type names:

VA SnippetContextC++ defaultsC# defaultsVB defaults
SuggestionsForType loopWithin a loop control structurecontinue;
break;
continue;
break;
N/A
SuggestionsForType switchWithin a switch statementcase
default:
break;
case
default:
break;
N/A
SuggestionsForType classWithin a class definitionpublic:
private:
protected:
virtual
void
bool
string
static
const
public
private
protected
virtual
void
bool
string
static
override
internal
Public
Private
Protected

Miscellaneous

Smart Suggestions may be completed with the Tab key regardless of the "Selections committed with" settings under VA Options | Advanced | Listboxes.