ViewFilter.QueryCommandStatus Method (Guid, UInt32)

 

Determines if the specified command is supported.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

protected virtual int QueryCommandStatus(
	ref Guid guidCmdGroup,
	uint nCmdId
)

Parameters

guidCmdGroup
Type: System.Guid

[in] The GUID of the command group.

nCmdId
Type: System.UInt32

[in] The ID of the command to examine.

Return Value

Type: System.Int32

If the command is supported, returns OLECMDF_SUPPORTED (typically with the OLECMDF_ENABLED flag added to indicate the command should be shown enabled); otherwise, returns OLECMDERR_E_NOTSUPPORTED if the command is not supported or OLECMDERR_E_UNKNOWNGROUP if the entire command group is not supported.

If your language service supports additional commands than those supported by the ViewFilter class, then you must derive a class from the ViewFilter class and override this method. Determine if your commands are supported first and then call the base method if the command is unrecognized.

The base method obtains the expansion provider and if a template is currently being edited, calls the HandleQueryStatus method on the ExpansionProvider class. If HandleQueryStatus returns true, then the base method returns the code from HandleQueryStatus. Otherwise, the base method reports that all the commands supported by the base ViewFilter class are supported — if certain conditions apply (see the command table below). The base method returns OLECMDERR_E_UNKNOWNGROUP if a command is not supported.

The following table lists the commands and the properties that must be set for the command to be supported.

Command

Condition for support

AUTOCOMPLETE

Always

COMMENTBLOCK

EnableCommenting = true

COMPLETEWORD

Always

FORMATDOCUMENT

CanReformat = true

FORMATSELECTION

CanReformat = true

GotoDecl

Always

GotoDefn

Always

GotoRef

Always

OUTLN_START_AUTOHIDING

OutliningEnabled = true

PARAMINFO

Always

QUICKINFO

EnableQuickInfo = true

SHOWMEMBERLIST

Always

UNCOMMENTBLOCK

EnableCommenting = true

Return to top
Show: