IntelliSense Quick Info (Managed Package Framework)

IntelliSense Quick Info shows information about an identifier in the source when the user either places the caret in the identifier and selects Quick Info from the IntelliSense menu or holds the mouse cursor over the identifier. This causes a tool tip to appear with information about the identifier. This information typically consists of the identifier type. When the debug engine is active, this information might include the current value. The debug engine supplies expression values , while 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 a 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 location 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

To enable the Quick Info feature, you must set the CodeSense and QuickInfo named parameters of the ProvideLanguageServiceAttribute.These attributes set the EnableCodeSense and EnableQuickInfo properties.

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 at the time the QUICKINFO command was sent. The ParseSource method parser must then parse the source up to the given location and then parse the identifier at the given location to determine what to display in the Quick Info tool tip.

Most parsers do an initial parse of the entire source file and store the results in a parse tree. The complete parse is carried out when Check is passed to ParseSource method. Other kinds of parsing can then use the parse tree to obtain the desired information.

For example, the parse reason value of QuickInfo can find the identifier at the source location and look it up in the parse tree to obtain the type information. This type information is then passed to the AuthoringScope class, and is returned by the GetDataTipText method.