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


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, string committedText, char commitCharacter, int index);

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


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


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


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


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


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