Partager via


CompletionSet.GetInitialExtent(Int32, Int32, Int32) Method

Definition

Gets the initial extent of the text to be completed.

public:
 virtual int GetInitialExtent([Runtime::InteropServices::Out] int % line, [Runtime::InteropServices::Out] int % startIdx, [Runtime::InteropServices::Out] int % endIdx);
 virtual int GetInitialExtent([Runtime::InteropServices::Out] int & line, [Runtime::InteropServices::Out] int & startIdx, [Runtime::InteropServices::Out] int & endIdx);
public virtual int GetInitialExtent (out int line, out int startIdx, out int endIdx);
abstract member GetInitialExtent : int * int * int -> int
override this.GetInitialExtent : int * int * int -> int
Public Overridable Function GetInitialExtent (ByRef line As Integer, ByRef startIdx As Integer, ByRef endIdx As Integer) As Integer

Parameters

line
Int32

[out] Returns the line number the text is on.

startIdx
Int32

[out] Returns the character offset of the first character of the text.

endIdx
Int32

[out] Returns the character offset of the last character of the text.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Implements

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.

Applies to