共用方式為


ExpansionProvider.DisplayExpansionBrowser Method

Displays a list of expansion templates of the specified type and kind.

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)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

Syntax

'宣告
Public Overridable Function DisplayExpansionBrowser ( _
    view As IVsTextView, _
    prompt As String, _
    types As String(), _
    includeNullType As Boolean, _
    kinds As String(), _
    includeNullKind As Boolean _
) As Boolean
public virtual bool DisplayExpansionBrowser(
    IVsTextView view,
    string prompt,
    string[] types,
    bool includeNullType,
    string[] kinds,
    bool includeNullKind
)

Parameters

  • prompt
    Type: System.String
    [in] A string containing the prompt in the browser box.
  • types
    Type: array<System.String[]
    [in] An array of strings containing the types of expansions to show. If this array is empty or a null value, then all types are shown in the browser box.
  • includeNullType
    Type: System.Boolean
    [in] This is true to allow "empty" types through the filter even if the types array is specified.
  • kinds
    Type: array<System.String[]
    [in] An array of strings containing the kinds of expansions to show. If this array is empty or a null value, then all kinds are shown in the browser box.
  • includeNullKind
    Type: System.Boolean
    [in] This is true to allow "empty" kinds through the filter even if the kinds array is specified.

Return Value

Type: System.Boolean
If successful, returns true; otherwise, returns false, the browser box was not displayed.

Remarks

Code snippets are organized by types and kinds. A kind describes what the snippet is; for example, "MethodBody", "Method", and "Type" are all kinds of snippets. A type, on the other hand, describes what the snippet is used for; for example, "SurroundsWith" (surrounds the selected text with the snippet) and "Expansion" (inserts and expands the snippet at the current location) are two types of snippets. See Code Element (IntelliSense Code Snippets) for details on snippet kinds. See SnippetType Element (IntelliSense Code Snippets) for details on snippet types.

The base method obtains the IVsTextManager2 object from the SVsTextManager service and calls the GetExpansionManager method on the IVsTextManager2object to obtain an IVsExpansionManager object. The base method then calls the InvokeInsertionUI method on the IVsExpansionManager object. The base method returns true if the InvokeInsertionUI method succeeded. If a previous expansion session was active, the base method calls the EndTemplateEditing method first before calling InvokeInsertionUI.

.NET Framework Security

See Also

Reference

ExpansionProvider Class

Microsoft.VisualStudio.Package Namespace