Partager via


CompletionSet.GetBestMatch Method

Determines which item in the list is the best match for the text typed so far by the user.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.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)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaration
Public Overridable Function GetBestMatch ( _
    textSoFar As String, _
    length As Integer, _
    <OutAttribute> ByRef index As Integer, _
    <OutAttribute> ByRef flags As UInteger _
) As Integer
public virtual int GetBestMatch(
    string textSoFar,
    int length,
    out int index,
    out uint flags
)
public:
virtual int GetBestMatch(
    String^ textSoFar, 
    int length, 
    [OutAttribute] int% index, 
    [OutAttribute] unsigned int% flags
)
abstract GetBestMatch : 
        textSoFar:string * 
        length:int * 
        index:int byref * 
        flags:uint32 byref -> int  
override GetBestMatch : 
        textSoFar:string * 
        length:int * 
        index:int byref * 
        flags:uint32 byref -> int
public function GetBestMatch(
    textSoFar : String, 
    length : int, 
    index : int, 
    flags : uint
) : int

Parameters

  • textSoFar
    Type: String

    [in] The text that has been typed by the user.

  • length
    Type: Int32

    [in] The length of the text typed by the user.

  • index
    Type: Int32%

    [out] Returns the index of the item in the Declarations object that best matches the typed text.

Return Value

Type: Int32
If successful, returns S_OK; otherwise, returns an error code.

Implements

IVsCompletionSet.GetBestMatch(String, Int32, Int32%, UInt32%)

Remarks

This method is an implementation of the GetBestMatch method on the IVsCompletionSet interface.

If textSoFar is not empty, the base method calls the GetBestMatch method on the Declarations object that was passed to the Init method; otherwise, if there is only one item in the Declarations list then that entry is used. If a match is found, the flags parameter is set to GBM_SELECT and if the match is unique (that is, there is only match in the list) then the flag GBM_UNIQUE is added to the flags parameter. The base method always returns a success code of S_OK.

.NET Framework Security

See Also

Reference

CompletionSet Class

Microsoft.VisualStudio.Package Namespace