Share via


IEditorHostService.CreateSpanAsync Method

Definition

Overloads

CreateSpanAsync(VersionedTextDocumentRangeContract, CancellationToken)

Creates a new TextRange from a serializable Range RPC contract and other version metadata.

CreateSpanAsync(Uri, Int32, Range, CancellationToken)

Creates a new TextRange from a serializable Range RPC contract and other version metadata.

CreateSpanAsync(VersionedTextDocumentRangeContract, CancellationToken)

Creates a new TextRange from a serializable Range RPC contract and other version metadata.

public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextRange> CreateSpanAsync (Microsoft.VisualStudio.RpcContracts.Utilities.VersionedTextDocumentRangeContract range, System.Threading.CancellationToken cancellationToken);
abstract member CreateSpanAsync : Microsoft.VisualStudio.RpcContracts.Utilities.VersionedTextDocumentRangeContract * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextRange>
Public Function CreateSpanAsync (range As VersionedTextDocumentRangeContract, cancellationToken As CancellationToken) As Task(Of TextRange)

Parameters

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 TextRanges when you actually need to view the content of the document and not just the range.

Applies to

CreateSpanAsync(Uri, Int32, Range, CancellationToken)

Creates a new TextRange from a serializable Range RPC contract and other version metadata.

public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextRange> CreateSpanAsync (Uri documentUri, int version, Microsoft.VisualStudio.RpcContracts.Utilities.Range range, System.Threading.CancellationToken cancellationToken);
abstract member CreateSpanAsync : Uri * int * Microsoft.VisualStudio.RpcContracts.Utilities.Range * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.TextRange>
Public Function CreateSpanAsync (documentUri As Uri, version As Integer, range As Range, cancellationToken As CancellationToken) As Task(Of TextRange)

Parameters

documentUri
Uri

The Uri of the document.

version
Int32

The version number to create the span on.

range
Range

The Range to realize into a TextRange.

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 TextRanges when you actually need to view the content of the document and not just the range.

Applies to