Share via


Declarations.OnAutoComplete(IVsTextView, String, Char, Int32) Method

Definition

Called after the declaration has been committed to the source file. When implemented in a derived class, it provides a completion character which may itself be a trigger for another round of IntelliSense.

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

Parameters

textView
IVsTextView

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

committedText
String

[in] A string containing the text that was inserted as part of the completion process.

commitCharacter
Char

[in] The character that was used to commit the text to the source file.

index
Int32

[in] The index of the item that was committed to the source file.

Returns

Returns a character to be inserted after the committed text. If nothing is to be inserted, returns 0.

Remarks

After text has been committed to the source file, this method is called to complete the characters already committed. For example, in the XML editor, if the user selects a start tag ("<tag"), this method is used to insert the end tag automatically ("></tag>"). The framework makes sure this method is called after Visual Studio has actually inserted the result from OnCommit, in this case "<tag".

This method can also be used to start another commitment based on the character that is returned. For example, if a method name is committed to the source file and the OnAutoComplete method returns an open parenthesis ("("), the "(" could then trigger the IntelliSense method tip operation.

The base method does nothing and returns 0.

Applies to