IEditorHostService.CreatePositionAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreatePositionAsync(VersionedTextDocumentPositionContract, CancellationToken) |
Creates a new TextPosition from a serializable VersionedTextDocumentPositionContract RPC contract and other version metadata. |
CreatePositionAsync(Uri, Int32, TextPositionContract, CancellationToken) |
Creates a new TextPosition from a serializable TextPositionContract RPC contract and other version metadata. |
CreatePositionAsync(VersionedTextDocumentPositionContract, CancellationToken)
Creates a new TextPosition from a serializable VersionedTextDocumentPositionContract RPC contract and other version metadata.
public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextPosition> CreatePositionAsync (Microsoft.VisualStudio.RpcContracts.Utilities.VersionedTextDocumentPositionContract textDocumentPosition, System.Threading.CancellationToken cancellationToken);
abstract member CreatePositionAsync : Microsoft.VisualStudio.RpcContracts.Utilities.VersionedTextDocumentPositionContract * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextPosition>
Public Function CreatePositionAsync (textDocumentPosition As VersionedTextDocumentPositionContract, cancellationToken As CancellationToken) As Task(Of TextPosition)
Parameters
- textDocumentPosition
- VersionedTextDocumentPositionContract
The VersionedTextDocumentPositionContract to realize into TextPosition.
- cancellationToken
- CancellationToken
Cancels the request.
Returns
A ITextDocumentSnapshot thick object that can be used to interact with the text of the span in the document.
Remarks
This overload potentially forces a load of the document if it's not yet open, accessible via Document. Since this is potentially expensive, it's recommended that you only create TextPositions when you actually need to view the content of the document and not just the range.
Applies to
CreatePositionAsync(Uri, Int32, TextPositionContract, CancellationToken)
Creates a new TextPosition from a serializable TextPositionContract RPC contract and other version metadata.
public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextPosition> CreatePositionAsync (Uri documentUri, int version, Microsoft.VisualStudio.RpcContracts.Utilities.TextPositionContract position, System.Threading.CancellationToken cancellationToken);
abstract member CreatePositionAsync : Uri * int * Microsoft.VisualStudio.RpcContracts.Utilities.TextPositionContract * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextPosition>
Public Function CreatePositionAsync (documentUri As Uri, version As Integer, position As TextPositionContract, cancellationToken As CancellationToken) As Task(Of TextPosition)
Parameters
- version
- Int32
The version number to create the span on.
- position
- TextPositionContract
The TextPositionContract to realize into a TextPosition.
- cancellationToken
- CancellationToken
Cancels the request.
Returns
A TextPosition thick object that can be used to interact with the text of the span in the document.
Remarks
This overload potentially forces a load of the document if it's not yet open, accessible via Document. Since this is potentially expensive, it's recommend that you only create TextRanges when you actually need to view the content of the document and not just the range.