VsExpansionManagerClass.GetExpansionByShortcut Method
Retrieves the title and path to a snippet given its shortcut name. See GetExpansionByShortcut.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)
Syntax
'宣告
Public Overridable Function GetExpansionByShortcut ( _
pClient As IVsExpansionClient, _
guidLang As Guid, _
szShortcut As String, _
pView As IVsTextView, _
pts As TextSpan(), _
fShowUI As Integer, _
<OutAttribute> ByRef pszExpansionPath As String, _
<OutAttribute> ByRef pszTitle As String _
) As Integer
public virtual int GetExpansionByShortcut(
IVsExpansionClient pClient,
Guid guidLang,
string szShortcut,
IVsTextView pView,
TextSpan[] pts,
int fShowUI,
out string pszExpansionPath,
out string pszTitle
)
public:
virtual int GetExpansionByShortcut(
[InAttribute] IVsExpansionClient^ pClient,
[InAttribute] Guid guidLang,
[InAttribute] String^ szShortcut,
[InAttribute] IVsTextView^ pView,
[InAttribute] array<TextSpan>^ pts,
[InAttribute] int fShowUI,
[OutAttribute] String^% pszExpansionPath,
[OutAttribute] String^% pszTitle
)
abstract GetExpansionByShortcut :
pClient:IVsExpansionClient *
guidLang:Guid *
szShortcut:string *
pView:IVsTextView *
pts:TextSpan[] *
fShowUI:int *
pszExpansionPath:string byref *
pszTitle:string byref -> int
override GetExpansionByShortcut :
pClient:IVsExpansionClient *
guidLang:Guid *
szShortcut:string *
pView:IVsTextView *
pts:TextSpan[] *
fShowUI:int *
pszExpansionPath:string byref *
pszTitle:string byref -> int
public function GetExpansionByShortcut(
pClient : IVsExpansionClient,
guidLang : Guid,
szShortcut : String,
pView : IVsTextView,
pts : TextSpan[],
fShowUI : int,
pszExpansionPath : String,
pszTitle : String
) : int
Parameters
- pClient
Type: Microsoft.VisualStudio.TextManager.Interop.IVsExpansionClient
[in] An IVsExpansionClient object representing the client that can control what code snippets can be inserted.
- guidLang
Type: System.Guid
[in] The GUID of the coding language (typically, this is the language service GUID).
- szShortcut
Type: System.String
[in] A string containing the shortcut name of the snippet.
- pView
Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextView
[in] An IVsTextView object used as the parent if the UI needs to be shown. This can be a null value if fShowUI is zero (FALSE).
- pts
Type: array<Microsoft.VisualStudio.TextManager.Interop.TextSpan[]
[in] A TextSpan object that describes the span (position and extent) where the code snippet is to be inserted.
- fShowUI
Type: System.Int32
[in] Non-zero (TRUE) if to show the UI to allow the user to choose among multiple snippets with the same shortcut name.
- pszExpansionPath
Type: System.String%
[out] Returns a string containing the full path to the snippet.
- pszTitle
Type: System.String%
[out] Returns a string containing the title of the snippet.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Implements
Remarks
COM Signature
From textmgr2.idl:
HRESULT IVsExpansionManager::GetExpansionByShortcut(
[in]GUID guidLang,
[in]WCHAR *szShortcut,
[in]IVsTextView *pView,
[in]bool fShowUI,
[out]BSTR *pszExpansionPath,
[out]BSTR *pszTitle
);
One scenario for calling this method is when a snippet shortcut name is selected from an IntelliSense completion list. The language service handling the completion passes the selected shortcut name to this method to get the path and title of the snippet. This information is then passed to the InsertNamedExpansion method in the IVsExpansion interface to insert the snippet into the document. In Visual Studio, the IVsExpansion interface can be obtained by calling the QueryInterface method in the IVsTextBuffer interface.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.