共用方式為


IVsExpansionManager.InvokeInsertionUI Method

Shows an IntelliSense list of code snippets that can be inserted into the source through the provided IVsExpansionClient object.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Syntax

'宣告
Function InvokeInsertionUI ( _
    pView As IVsTextView, _
    pClient As IVsExpansionClient, _
    guidLang As Guid, _
    bstrTypes As String(), _
    iCountTypes As Integer, _
    fIncludeNULLType As Integer, _
    bstrKinds As String(), _
    iCountKinds As Integer, _
    fIncludeNULLKind As Integer, _
    bstrPrefixText As String, _
    bstrCompletionChar As String _
) As Integer
int InvokeInsertionUI(
    IVsTextView pView,
    IVsExpansionClient pClient,
    Guid guidLang,
    string[] bstrTypes,
    int iCountTypes,
    int fIncludeNULLType,
    string[] bstrKinds,
    int iCountKinds,
    int fIncludeNULLKind,
    string bstrPrefixText,
    string bstrCompletionChar
)
int InvokeInsertionUI(
    [InAttribute] IVsTextView^ pView, 
    [InAttribute] IVsExpansionClient^ pClient, 
    [InAttribute] Guid guidLang, 
    [InAttribute] array<String^>^ bstrTypes, 
    [InAttribute] int iCountTypes, 
    [InAttribute] int fIncludeNULLType, 
    [InAttribute] array<String^>^ bstrKinds, 
    [InAttribute] int iCountKinds, 
    [InAttribute] int fIncludeNULLKind, 
    [InAttribute] String^ bstrPrefixText, 
    [InAttribute] String^ bstrCompletionChar
)
abstract InvokeInsertionUI : 
        pView:IVsTextView * 
        pClient:IVsExpansionClient * 
        guidLang:Guid * 
        bstrTypes:string[] * 
        iCountTypes:int * 
        fIncludeNULLType:int * 
        bstrKinds:string[] * 
        iCountKinds:int * 
        fIncludeNULLKind:int * 
        bstrPrefixText:string * 
        bstrCompletionChar:string -> int 
function InvokeInsertionUI(
    pView : IVsTextView, 
    pClient : IVsExpansionClient, 
    guidLang : Guid, 
    bstrTypes : String[], 
    iCountTypes : int, 
    fIncludeNULLType : int, 
    bstrKinds : String[], 
    iCountKinds : int, 
    fIncludeNULLKind : int, 
    bstrPrefixText : String, 
    bstrCompletionChar : String
) : int

Parameters

  • guidLang
    Type: System.Guid
    [in] The GUID of the coding language (typically, this is the language service GUID).
  • bstrTypes
    Type: array<System.String[]
    [in] An array strings specifying snippet types to display. This can be a null value if iCountTypes is 0. See Remarks.
  • iCountTypes
    Type: System.Int32
    [in] The number of types specified in the bstrTypes array. If this is 0, all types are displayed.
  • fIncludeNULLType
    Type: System.Int32
    [in] Non-zero (TRUE) if to include code snippets with "empty" types in the bstrTypes list (this parameter is ignored if iCountTypes is 0).
  • bstrKinds
    Type: array<System.String[]
    [in] An array of strings specifying the snippet kinds to display. This can be a null value if iCountKinds is 0. See Remarks.
  • iCountKinds
    Type: System.Int32
    [in] The number of kinds specified in the bstrKinds array. If this is 0, all kinds are displayed.
  • fIncludeNULLKind
    Type: System.Int32
    [in] Non-zero (TRUE) if to include code snippets with "empty" kinds in the bstrKinds list (this parameter is ignored if iCountKinds is 0).
  • bstrPrefixText
    Type: System.String
    [in] A string containing the text to show in the prompt.
  • bstrCompletionChar
    Type: System.String
    [in] A character that, when typed, inserts the currently selected snippet and closes the UI. If this is a null value or an empty string, typing the Enter key is the only way to insert a selected snippet.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr2.idl:

HRESULT IVsExpansionManager::InvokeInsertionUI(
   [in] IVsTextView *pView,
   [in]IVsExpansionClient *pClient,
   [in]GUID guidLang,
   [in, size_is(iCountTypes)] BSTR *bstrTypes,
   [in] long iCountTypes,
   [in] bool fIncludeNULLType,
   [in, size_is(iCountKinds)] BSTR *bstrKinds,
   [in] long iCountKinds,
   [in] bool fIncludeNULLKind,
   [in] BSTR bstrPrefixText,
   [in] BSTR bstrCompletionChar
);

The bstrTypes list contains strings that specify the types of snippets to display. These types can be "Expansion" or "SurroundsWith" (see SnippetType Element (IntelliSense Code Snippets) for details on snippet types). It is possible for a code snippet to not have a type associated with it, in which case such snippets are not displayed unless the fIncludeNULLType parameter is non-zero (TRUE) or the iCountTypes parameter is 0.

The bstrKinds list contains strings that specify the kinds of snippets to display, such as MethodBody, Page, and File. The snippet kind can control in what context the snippet is inserted. For example, a snippet kind of MethodBody should be inserted only in a method. See Code Element (IntelliSense Code Snippets) for a list of all snippet kinds that are supported. It is possible for a code snippet to not have a kind associated with it, in which case such snippets are not displayed unless the fIncludeNULLKind parameter is non-zero (TRUE) or the iCountKinds parameter is 0.

.NET Framework Security

See Also

Reference

IVsExpansionManager Interface

Microsoft.VisualStudio.TextManager.Interop Namespace

Other Resources

SnippetType Element (IntelliSense Code Snippets)

Code Element (IntelliSense Code Snippets)