Declarations.OnCommit Method
Called to commit the specified item to the source file.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Syntax
'Declaration
Public Overridable Function OnCommit ( _
textView As IVsTextView, _
textSoFar As String, _
commitCharacter As Char, _
index As Integer, _
ByRef initialExtent As TextSpan _
) As String
'Usage
Dim instance As Declarations
Dim textView As IVsTextView
Dim textSoFar As String
Dim commitCharacter As Char
Dim index As Integer
Dim initialExtent As TextSpan
Dim returnValue As String
returnValue = instance.OnCommit(textView, _
textSoFar, commitCharacter, index, _
initialExtent)
public virtual string OnCommit(
IVsTextView textView,
string textSoFar,
char commitCharacter,
int index,
ref TextSpan initialExtent
)
public:
virtual String^ OnCommit(
IVsTextView^ textView,
String^ textSoFar,
wchar_t commitCharacter,
int index,
TextSpan% initialExtent
)
abstract OnCommit :
textView:IVsTextView *
textSoFar:string *
commitCharacter:char *
index:int *
initialExtent:TextSpan byref -> string
override OnCommit :
textView:IVsTextView *
textSoFar:string *
commitCharacter:char *
index:int *
initialExtent:TextSpan byref -> string
public function OnCommit(
textView : IVsTextView,
textSoFar : String,
commitCharacter : char,
index : int,
initialExtent : TextSpan
) : String
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 nulla null reference (Nothing in Visual Basic).
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.
.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.