IEditorHostService.CreateSpanAsync 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
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)
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
The VersionedTextDocumentRangeContract 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
CreateSpanAsync(Uri, Int32, Range, CancellationToken)
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
- version
- Int32
The version number to create the span on.
- 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.