Compartilhar via


Declarations.OnAutoComplete 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.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaration
Public Overridable Function OnAutoComplete ( _
    textView As IVsTextView, _
    committedText As String, _
    commitCharacter As Char, _
    index As Integer _
) As Char
public virtual char OnAutoComplete(
    IVsTextView textView,
    string committedText,
    char commitCharacter,
    int index
)
public:
virtual wchar_t OnAutoComplete(
    IVsTextView^ textView, 
    String^ committedText, 
    wchar_t commitCharacter, 
    int index
)
abstract OnAutoComplete : 
        textView:IVsTextView * 
        committedText:string * 
        commitCharacter:char * 
        index:int -> char  
override OnAutoComplete : 
        textView:IVsTextView * 
        committedText:string * 
        commitCharacter:char * 
        index:int -> char
public function OnAutoComplete(
    textView : IVsTextView, 
    committedText : String, 
    commitCharacter : char, 
    index : int
) : char

Parameters

  • committedText
    Type: String

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

  • commitCharacter
    Type: Char

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

  • index
    Type: Int32

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

Return Value

Type: Char
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.

.NET Framework Security

See Also

Reference

Declarations Class

Microsoft.VisualStudio.Package Namespace