다음을 통해 공유


ViewFilter.QueryCommandStatus Method

Determines if the specified command is supported.

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

Syntax

‘선언
Protected Overridable Function QueryCommandStatus ( _
    ByRef guidCmdGroup As Guid, _
    nCmdId As UInteger _
) As Integer
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.

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

Microsoft.VisualStudio.Package Namespace