Partager via


ITextViewSnapshot.GetOptionValueAsync Method

Definition

Overloads

GetOptionValueAsync<T>(TextDocumentOption<T>, CancellationToken)

Gets an editor option value based on the scope of text document in this view.

GetOptionValueAsync<T>(TextViewOption<T>, CancellationToken)

Gets an editor option value based on the current text view scope.

GetOptionValueAsync<T>(TextDocumentOption<T>, CancellationToken)

Gets an editor option value based on the scope of text document in this view.

public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.EditorOptionValue<T?>> GetOptionValueAsync<T> (Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption<T> option, System.Threading.CancellationToken cancellationToken);
abstract member GetOptionValueAsync : Microsoft.VisualStudio.Extensibility.Editor.TextDocumentOption<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.EditorOptionValue<'T>>
Public Function GetOptionValueAsync(Of T) (option As TextDocumentOption(Of T), cancellationToken As CancellationToken) As Task(Of EditorOptionValue(Of T))

Type Parameters

T

Type of the option value.

Parameters

option
TextDocumentOption<T>

Option identifier.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

This method returns either:

  • the current value of option.
  • the defined default value if option is defined but not set.

Exceptions

Throw when option is not set in this scope.

Applies to

GetOptionValueAsync<T>(TextViewOption<T>, CancellationToken)

Gets an editor option value based on the current text view scope.

public System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.EditorOptionValue<T?>> GetOptionValueAsync<T> (Microsoft.VisualStudio.Extensibility.Editor.TextViewOption<T> option, System.Threading.CancellationToken cancellationToken);
abstract member GetOptionValueAsync : Microsoft.VisualStudio.Extensibility.Editor.TextViewOption<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Extensibility.Editor.EditorOptionValue<'T>>
Public Function GetOptionValueAsync(Of T) (option As TextViewOption(Of T), cancellationToken As CancellationToken) As Task(Of EditorOptionValue(Of T))

Type Parameters

T

Type of the option value.

Parameters

option
TextViewOption<T>

Option identifier.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

This method returns either:

  • the current value of option.
  • the defined default value if option is defined but not set..

Exceptions

Throw when option is not set in this scope.

Applies to