Partager via


EditorExtensibility.SubscribeToOptionChangesAsync Method

Definition

Overloads

SubscribeToOptionChangesAsync<T>(ITextDocumentSnapshot, TextDocumentOption<T>, CancellationToken, Func<T,Task>)

Registers to listen for option changes in the scope of a text document.

SubscribeToOptionChangesAsync<T>(ITextViewSnapshot, TextViewOption<T>, CancellationToken, Func<T,Task>)

Registers to listen for option changes in the scope of a text view.

SubscribeToOptionChangesAsync<T>(ITextDocumentSnapshot, TextDocumentOption<T>, CancellationToken, Func<T,Task>)

Registers to listen for option changes in the scope of a text document.

public System.Threading.Tasks.Task<IDisposable> SubscribeToOptionChangesAsync<T> (Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot document, Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption<T> textDocumentOption, System.Threading.CancellationToken cancellationToken, Func<T?,System.Threading.Tasks.Task> changeHandler);
member this.SubscribeToOptionChangesAsync : Microsoft.VisualStudio.Extensibility.Editor.ITextDocumentSnapshot * Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption<'T> * System.Threading.CancellationToken * Func<'T, System.Threading.Tasks.Task> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeToOptionChangesAsync(Of T) (document As ITextDocumentSnapshot, textDocumentOption As TextDocumentOption(Of T), cancellationToken As CancellationToken, changeHandler As Func(Of T, Task)) As Task(Of IDisposable)

Type Parameters

T

Type of the option value.

Parameters

document
ITextDocumentSnapshot

Document snapshot to use as the scope.

textDocumentOption
TextDocumentOption<T>

Option identifier.

cancellationToken
CancellationToken

Cancellation token to monitor while subscribing.

changeHandler
Func<T,Task>

Change handler to invoke, this handler will always be called once with the initial value.

Returns

an IDisposable to manage the lifetime of the subscription.

Exceptions

Thrown when option is not defined in this scope.

Remarks

The change handler will be called in series awaiting previous calls.

Applies to

SubscribeToOptionChangesAsync<T>(ITextViewSnapshot, TextViewOption<T>, CancellationToken, Func<T,Task>)

Registers to listen for option changes in the scope of a text view.

public System.Threading.Tasks.Task<IDisposable> SubscribeToOptionChangesAsync<T> (Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot textView, Microsoft.VisualStudio.Extensibility.Editor.TextViewOption<T> textViewOption, System.Threading.CancellationToken cancellationToken, Func<T?,System.Threading.Tasks.Task> changeHandler);
member this.SubscribeToOptionChangesAsync : Microsoft.VisualStudio.Extensibility.Editor.ITextViewSnapshot * Microsoft.VisualStudio.Extensibility.Editor.TextViewOption<'T> * System.Threading.CancellationToken * Func<'T, System.Threading.Tasks.Task> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeToOptionChangesAsync(Of T) (textView As ITextViewSnapshot, textViewOption As TextViewOption(Of T), cancellationToken As CancellationToken, changeHandler As Func(Of T, Task)) As Task(Of IDisposable)

Type Parameters

T

Type of the option value.

Parameters

textView
ITextViewSnapshot

Text view snapshot to use as the scope.

textViewOption
TextViewOption<T>

Option identifier.

cancellationToken
CancellationToken

Cancellation token to monitor while subscribing.

changeHandler
Func<T,Task>

Change handler to invoke, this handler will always be called once with the initial value.

Returns

an IDisposable to manage the lifetime of the subscription.

Exceptions

Thrown when option is not defined in this scope.

Remarks

The change handler will be called in series awaiting previous calls.

Applies to