Share via


EditorExtensibility.GetActiveTextViewAsync Method

Definition

Gets the currently focused ITextViewSnapshot in the host Visual Studio process.

public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot?> GetActiveTextViewAsync (Microsoft.VisualStudio.Extensibility.IClientContext clientContext, System.Threading.CancellationToken cancellationToken);
member this.GetActiveTextViewAsync : Microsoft.VisualStudio.Extensibility.IClientContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot>
Public Function GetActiveTextViewAsync (clientContext As IClientContext, cancellationToken As CancellationToken) As Task(Of ITextViewSnapshot)

Parameters

clientContext
IClientContext

The client context, usually passed to command handlers.

cancellationToken
CancellationToken

Cancels the request.

Returns

An instance of ITextViewSnapshot or null.

Remarks

Can return null if the clientContext references a version of text view that is sufficiently old so as to no longer be cached.

Applies to