Condividi tramite


Important Commands for Language Service Filters

If you want to create a fully featured language service filter, consider handling the following commands. The full list of command identifiers is defined in the VSConstants.VSStd2KCmdID enumeration for managed code and the Stdidcmd.h header file for unmanaged Visual C++ code. You can find the Stdidcmd.h file in Visual Studio SDK installation path\VisualStudioIntegration\Common\Inc.

Commands to Handle

Nota

It is not mandatory to filter for every command in the following table.

Command

Description

SHOWCONTEXTMENU

Sent when the user right-clicks. This command indicates that it is time to provide a shortcut menu. If you do not handle this command, the text editor provides a default shortcut menu without any language-specific commands. To include your own commands on this menu, handle the command and display a shortcut menu yourself.

SHOWMEMBERLIST

Typically sent when the user types CTRL+J. Call the UpdateCompletionStatus method on the IVsTextView to show the statement completion box.

TYPECHAR

Sent when the user types a character. Monitor this command to determine when a trigger character is typed and to provide statement completion, method tips, and text markers, such as syntax coloring, brace matching, and error markers. Call the UpdateCompletionStatus method on the IVsTextView for statement completion and the SetMethodData method on the IVsMethodTipWindow for method tips. To support text markers, monitor this command to determine whether the character being typed requires that you update your markers.

RETURN

Sent when the user types the Enter key. Monitor this command to determine when to dismiss a method tip window by calling the OnDismiss method on the IVsMethodData. By default, the text view handles this command.

BACKSPACE

Sent when the user types the Backspace key. Monitor to determine when to dismiss a method tip window by calling the OnDismiss method on the IVsMethodData. By default, the text view handles this command.

PARAMINFO

Sent from a menu or a shortcut key. Call the UpdateTipWindow method on the IVsTextView to update the tip window with the parameter information.

QUICKINFO

Sent when the user hovers over a variable or positions the cursor on a variable and selects Quick Info from IntelliSense in the Edit menu. Return the type of the variable in a tip by calling the UpdateTipWindow method on the IVsTextView. If debugging is active, the tip should also show the value of the variable.

COMPLETEWORD

Typically sent when the user types CTRL+SPACEBAR. This command tells the language service to call the UpdateCompletionStatus method on the IVsTextView.

COMMENT_BLOCK

UNCOMMENT_BLOCK

Sent from a menu, typically Comment Selection or Uncomment Selection from Advanced in the Edit menu. COMMENT_BLOCK indicates that the user wants to comment out the selected text; COMMENT_BLOCK indicates that the user wants to uncomment the selected text. These commands can be implemented only by the language service.

See Also

Other Resources

Developing a Language Service