This documentation is archived and is not being maintained.

Supporting IntelliSense Quick Info (Managed Package Framework)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The IntelliSense Quick Info operation shows information about a particular identifier in the source when the user positions the caret in the identifier and selects Quick Info from the IntelliSense menu or holds the mouse cursor over the identifier. In either case, a tool tip appears displaying information about the identifier. This information typically consists of the identifier's type. When the debug engine is active, this information might include the value stored in a variable as well as the type (the debug engine would supply the value of a selected expression, not the language service; the language service handles only identifiers).

The managed package framework (MPF) language service classes provide full support for displaying the IntelliSense Quick Info tool tip. All you have to do is supply the text to be displayed and enable the quick info feature.

The text to be displayed is obtained by calling the ParseSource method parser with the parse reason value of QuickInfo. This reason tells the parser to obtain the type information (or whatever is appropriate to be displayed in the Quick Info tool tip) for the identifier at the position specified in the ParseRequest object. The ParseRequest object is what was passed to the ParseSource method.

The parser must parse everything up to the position in the ParseRequest object in order to determine the types of all identifiers. Then the parser must get the identifier at the parse request location. Finally, the parser must pass the tool tip data associated with that identifier to the AuthoringScope object so that object can return the text from the GetDataTipText method.

Enabling the Quick Info Feature

You must have the CodeSense registry entry set to 1 to support any IntelliSense operation. This registry entry can be set with a named parameter passed to the ProvideLanguageServiceAttribute user attribute associated with the language package. The language service classes read the value of this registry entry from the EnableCodeSense property on the LanguagePreferences class.

In addition, the registry entry QuickInfo, when set to 1, indicates the language service supports the IntelliSense Quick Info operation. This registry entry can be set with a named parameter passed to the ProvideLanguageServiceAttribute user attribute associated with the language package. The language service classes read the value of this registry entry from the EnableQuickInfo property on the LanguagePreferences class.

Implementing the Quick Info Feature

The ViewFilter class handles the IntelliSense Quick Info operation. When the ViewFilter class receives the QUICKINFO command, the class calls the ParseSource method with the parse reason of QuickInfo and the location of the caret or cursor at the time the QUICKINFO command was sent. The ParseSource method parser must then parse the source up to the given position and then parse the identifier at the given position to determine what to display in the Quick Info tool tip.

In a typical parser, the entire source file has been parsed and stored in what is called a parse tree and every node in the tree represents a token that is specific to the language. This initial parsing of the entire source is carried out when the parse reason value of Check is given to the parser. Other reasons for parsing can then use the parse tree to quickly obtain the desired information.

For example, the parse reason value of QuickInfo can examine the identifier at the requested parse location and look up that identifier in the parse tree to obtain the type information associated with that identifier. This type information is then formatted into a string and is given to your version of the AuthoringScope class to be returned by the GetDataTipText method.

See Also

Show: