Declarations::OnCommit Method (IVsTextView^, String^, Char, Int32, TextSpan)

 

Called to commit the specified item to the source file.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
virtual String^ OnCommit(
	IVsTextView^ textView,
	String^ textSoFar,
	wchar_t commitCharacter,
	int index,
	TextSpan% initialExtent
)

Parameters

textView
Type: Microsoft.VisualStudio.TextManager.Interop::IVsTextView^

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

textSoFar
Type: System::String^

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

commitCharacter
Type: System::Char

[in] The character used to commit the text.

index
Type: System::Int32

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

initialExtent
Type: Microsoft.VisualStudio.TextManager.Interop::TextSpan

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

Return Value

Type: System::String^

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

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.

Return to top
Show: