EditorExtensibility.GetActiveTextViewAsync 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.
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.