Compartir a través de


Declarations.OnCommit(IVsTextView, String, Char, Int32, TextSpan) Method

Definition

Called to commit the specified item to the source file.

public:
 virtual System::String ^ OnCommit(Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ textView, System::String ^ textSoFar, char commitCharacter, int index, Microsoft::VisualStudio::TextManager::Interop::TextSpan % initialExtent);
public:
 virtual Platform::String ^ OnCommit(Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ textView, Platform::String ^ textSoFar, char16 commitCharacter, int index, Microsoft::VisualStudio::TextManager::Interop::TextSpan &  initialExtent);
 virtual std::wstring OnCommit(Microsoft::VisualStudio::TextManager::Interop::IVsTextView const & textView, std::wstring const & textSoFar, char commitCharacter, int index, Microsoft::VisualStudio::TextManager::Interop::TextSpan & initialExtent);
public virtual string OnCommit (Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView, string textSoFar, char commitCharacter, int index, ref Microsoft.VisualStudio.TextManager.Interop.TextSpan initialExtent);
abstract member OnCommit : Microsoft.VisualStudio.TextManager.Interop.IVsTextView * string * char * int * TextSpan -> string
override this.OnCommit : Microsoft.VisualStudio.TextManager.Interop.IVsTextView * string * char * int * TextSpan -> string
Public Overridable Function OnCommit (textView As IVsTextView, textSoFar As String, commitCharacter As Char, index As Integer, ByRef initialExtent As TextSpan) As String

Parameters

textView
IVsTextView

[in] An IVsTextView object representing the view that displays the source file.

textSoFar
String

[in] A string containing the text that has been typed by the user.

commitCharacter
Char

[in] The character used to commit the text.

index
Int32

[in] The index of the item to commit to the source file.

initialExtent
TextSpan

[in, out] A TextSpan object specifying the text typed so far. Returns the span of the committed text.

Returns

If successful, returns a string containing the text to commit to the source file; otherwise, returns null.

Remarks

What is actually committed is dependent on how you implement the Declarations class. Typically, what is shown in the completion list is also what is returned from this method so there is a one-to-one correspondence to what the user sees in the list and what is inserted into the source file. Sometimes, however, what is shown in the list is not what should be inserted into the source file. For example, in C++, the completion list might show a complete method signature but what is actually inserted is only the name of the method.

The base method returns the string returned from a call to the GetName method.

Applies to