ViewFilter.QueryCommandStatus Method

Determines if the specified command is supported.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)

Syntax

声明
Protected Overridable Function QueryCommandStatus ( _
    ByRef guidCmdGroup As Guid, _
    nCmdId As UInteger _
) As Integer
用法
Dim guidCmdGroup As Guid
Dim nCmdId As UInteger
Dim returnValue As Integer

returnValue = Me.QueryCommandStatus(guidCmdGroup, _
    nCmdId)
protected virtual int QueryCommandStatus(
    ref Guid guidCmdGroup,
    uint nCmdId
)
protected:
virtual int QueryCommandStatus(
    Guid% guidCmdGroup, 
    unsigned int nCmdId
)
abstract QueryCommandStatus : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 -> int 
override QueryCommandStatus : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 -> int 
protected function QueryCommandStatus(
    guidCmdGroup : Guid, 
    nCmdId : uint
) : int

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.

Remarks

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

.NET Framework Security

See Also

Reference

ViewFilter Class

ViewFilter Members

Microsoft.VisualStudio.Package Namespace