次の方法で共有


ExpansionProvider.InsertNamedExpansion Method

Definition

Inserts the specified snippet into the source at the given position.

public:
 virtual bool InsertNamedExpansion(Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ view, System::String ^ title, System::String ^ path, Microsoft::VisualStudio::TextManager::Interop::TextSpan pos, bool showDisambiguationUI);
public:
 virtual bool InsertNamedExpansion(Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ view, Platform::String ^ title, Platform::String ^ path, Microsoft::VisualStudio::TextManager::Interop::TextSpan pos, bool showDisambiguationUI);
 virtual bool InsertNamedExpansion(Microsoft::VisualStudio::TextManager::Interop::IVsTextView const & view, std::wstring const & title, std::wstring const & path, Microsoft::VisualStudio::TextManager::Interop::TextSpan pos, bool showDisambiguationUI);
public virtual bool InsertNamedExpansion (Microsoft.VisualStudio.TextManager.Interop.IVsTextView view, string title, string path, Microsoft.VisualStudio.TextManager.Interop.TextSpan pos, bool showDisambiguationUI);
abstract member InsertNamedExpansion : Microsoft.VisualStudio.TextManager.Interop.IVsTextView * string * string * Microsoft.VisualStudio.TextManager.Interop.TextSpan * bool -> bool
override this.InsertNamedExpansion : Microsoft.VisualStudio.TextManager.Interop.IVsTextView * string * string * Microsoft.VisualStudio.TextManager.Interop.TextSpan * bool -> bool
Public Overridable Function InsertNamedExpansion (view As IVsTextView, title As String, path As String, pos As TextSpan, showDisambiguationUI As Boolean) As Boolean

Parameters

view
IVsTextView

[in] An IVsTextView object representing the view showing the source.

title
String

[in] A string containing the name or title of the snippet.

path
String

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

pos
TextSpan

[in] A TextSpan object specifying the position where the snippet is to be inserted.

showDisambiguationUI
Boolean

[in] This is true if there is more than one snippet with the given title and a dialog box must be shown so the user can select which snippet to insert; otherwise, this is false (accept the first snippet with the given title).

Returns

If a snippet was inserted, returns true; otherwise, returns false.

Remarks

This is a helper method that can be called from your own code, typically in association with the FindExpansionByShortcut method. See the example in the ViewFilter class to see how this method is used.

The base method calls the InsertNamedExpansion method on the IVsExpansion object. If InsertNamedExpansion succeeds, the ExpansionProvider class is put into the edit expansion mode and the base method returns true. Otherwise, the edit session is ended and the base method returns false.

Applies to