Freigeben über


IHostTaskExecutor.ExecuteTaskAsync<TOutput> Method

Definition

Executes a task in host environment if host task executor is available. This is critical to trust between LSP and its hosts. LSP should correctly use this and wrap particulat steps that need to run in host using these methods.

public System.Threading.Tasks.Task<TOutput> ExecuteTaskAsync<TOutput>(Func<System.Threading.Tasks.Task<TOutput>> task, Microsoft.PowerFx.LanguageServerProtocol.Handlers.LanguageServerOperationContext operationContext, System.Threading.CancellationToken cancellationToken, TOutput defaultOutput = default);
abstract member ExecuteTaskAsync : Func<System.Threading.Tasks.Task<'Output>> * Microsoft.PowerFx.LanguageServerProtocol.Handlers.LanguageServerOperationContext * System.Threading.CancellationToken * 'Output -> System.Threading.Tasks.Task<'Output>
Public Function ExecuteTaskAsync(Of TOutput) (task As Func(Of Task(Of TOutput)), operationContext As LanguageServerOperationContext, cancellationToken As CancellationToken, Optional defaultOutput As TOutput = Nothing) As Task(Of TOutput)

Type Parameters

TOutput

Output Type.

Parameters

task
Func<Task<TOutput>>

Task to run inside host.

operationContext
LanguageServerOperationContext

Language Server Operation Context.

cancellationToken
CancellationToken

Cancellation Token.

defaultOutput
TOutput

Default Output to return if the provided task is canceled by host.

Returns

Task<TOutput>

Output.

Applies to