IVsExpansionClient.OnItemChosen(String, String) Method

Definition

Called when a code snippet name has been selected from an IntelliSense menu.

public:
 int OnItemChosen(System::String ^ pszTitle, System::String ^ pszPath);
public:
 int OnItemChosen(Platform::String ^ pszTitle, Platform::String ^ pszPath);
int OnItemChosen(std::wstring const & pszTitle, std::wstring const & pszPath);
public int OnItemChosen (string pszTitle, string pszPath);
abstract member OnItemChosen : string * string -> int
Public Function OnItemChosen (pszTitle As String, pszPath As String) As Integer

Parameters

pszTitle
String

[in] A string containing the full name of the code snippet.

pszPath
String

[in] A string containing the full path to the snippet file.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr2.idl:

HRESULT IVsExpansionClient::OnItemChosen(  
   [in] BSTR pszTitle,  
   [in] BSTR pszPath  
);  

This method is called when the user selects a code snippet from a list of snippets, typically presented in an IntelliSense menu. The menu is shown as a result of a call to the InvokeInsertionUI method in the IVsExpansionManager interface.

A typical implementation of the OnItemChosen method is to call the InsertNamedExpansion method on the IVsExpansion object that was cached in the IVsExpansionClient object before the InvokeInsertionUI method was called. In fact, the only time the OnItemChosen method is called is when the InvokeInsertionUI method is called, either as a result of the user selecting a menu option that triggers the call or if the user is allowed to choose from multiple code snippets that have the same name (for example, if a code snippet shortcut matches more than one code snippet, a "disambiguation user interface" is shown to allow the user to select which code snippet to actually insert).

Applies to