共用方式為


CompletionSet.GetInitialExtent Method

Gets the initial extent of the text to be completed.

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

Syntax

'宣告
Public Overridable Function GetInitialExtent ( _
    <OutAttribute> ByRef line As Integer, _
    <OutAttribute> ByRef startIdx As Integer, _
    <OutAttribute> ByRef endIdx As Integer _
) As Integer
'用途
Dim instance As CompletionSet
Dim line As Integer
Dim startIdx As Integer
Dim endIdx As Integer
Dim returnValue As Integer

returnValue = instance.GetInitialExtent(line, _
    startIdx, endIdx)
public virtual int GetInitialExtent(
    out int line,
    out int startIdx,
    out int endIdx
)
public:
virtual int GetInitialExtent(
    [OutAttribute] int% line, 
    [OutAttribute] int% startIdx, 
    [OutAttribute] int% endIdx
)
abstract GetInitialExtent : 
        line:int byref * 
        startIdx:int byref * 
        endIdx:int byref -> int 
override GetInitialExtent : 
        line:int byref * 
        startIdx:int byref * 
        endIdx:int byref -> int 
public function GetInitialExtent(
    line : int, 
    startIdx : int, 
    endIdx : int
) : int

Parameters

  • line
    Type: System.Int32%
    [out] Returns the line number the text is on.
  • startIdx
    Type: System.Int32%
    [out] Returns the character offset of the first character of the text.
  • endIdx
    Type: System.Int32%
    [out] Returns the character offset of the last character of the text.

Return Value

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

Implements

IVsCompletionSet.GetInitialExtent(Int32%, Int32%, Int32%)

Remarks

The initial extent is used to replace the text being completed with the selected item from the completion list.

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

The base method first calls the GetInitialExtent method on the Declarations object that was passed to the Init method. If that call fails, the base method calls the GetCaretPos on the IVsTextView object passed to the Init method to get the current caret position. The base method then calls the GetWordExtent method on the Source object that was passed to the CompletionSet class constructor to retrieve the extent of the word containing the caret. If that call fails, the base method calls GetWordExtent again, this time with the position to the left of the caret. If that second call fails, the base method returns E_NOTIMPL; otherwise, the base method returns the found extent and returns a success code of S_OK. In other words, the base method tries very hard to determine the initial extent.

.NET Framework Security

See Also

Reference

CompletionSet Class

CompletionSet Members

Microsoft.VisualStudio.Package Namespace