Table of Contents

Class ChildConnection

Namespace
RDCore.SDK.Client.Connection
Assembly
RDCore.SDK.dll

Owns one supervised child process, its transport pipe, and its LanguageClient, and drives them through the ConnectionState lifecycle, including restart-with-backoff.

public sealed class ChildConnection : IDisposable
Inheritance
ChildConnection
Implements
Inherited Members

Constructors

ChildConnection(IRDCoreServerProcess, ILanguageServerProtocolTransportLayer, ILogger<ChildConnection>)

Owns one supervised child process, its transport pipe, and its LanguageClient, and drives them through the ConnectionState lifecycle, including restart-with-backoff.

public ChildConnection(IRDCoreServerProcess serverProcess, ILanguageServerProtocolTransportLayer transportLayer, ILogger<ChildConnection> logger)

Parameters

serverProcess IRDCoreServerProcess
transportLayer ILanguageServerProtocolTransportLayer
logger ILogger<ChildConnection>

Properties

Client

The live language client. Throws until the connection is Ready.

public ILanguageClient Client { get; }

Property Value

ILanguageClient

PlatformInfo

The result of the rdcore/platform/initialize handshake, once the connection is Ready.

public PlatformInitializeResult? PlatformInfo { get; }

Property Value

PlatformInitializeResult

State

The current lifecycle state of the connection.

public ConnectionState State { get; }

Property Value

ConnectionState

Methods

ConnectAsync(ChildConnectionRequest, CancellationToken)

Drives the connection from NotStarted to Ready. Initial failures are not retried: the state becomes Faulted and the exception is rethrown.

public Task ConnectAsync(ChildConnectionRequest request, CancellationToken token)

Parameters

request ChildConnectionRequest

The connection inputs.

token CancellationToken

Cancels the connection attempt.

Returns

Task

Dispose()

Cancels any in-flight connection work and disposes the process, pipe, and client.

public void Dispose()

SendNotificationAsync<TParams>(TParams, CancellationToken)

Sends a notification over the connection.

public Task SendNotificationAsync<TParams>(TParams notification, CancellationToken token) where TParams : IRequest

Parameters

notification TParams

The notification parameters.

token CancellationToken

Cancels before the notification is sent.

Returns

Task

Type Parameters

TParams

The notification parameter type.

SendRequestAsync<TParams, TResult>(TParams, CancellationToken)

Sends a request over the connection.

public Task<TResult> SendRequestAsync<TParams, TResult>(TParams request, CancellationToken token) where TParams : IRequest<TResult>

Parameters

request TParams

The request parameters.

token CancellationToken

Cancels the request.

Returns

Task<TResult>

Type Parameters

TParams

The request parameter type.

TResult

The response type.

ShutdownAsync()

Graceful teardown: LSP shutdown request, then exit notification, then a bounded wait for the process, then a kill. Suppresses restart. Idempotent.

public Task ShutdownAsync()

Returns

Task

WaitForExitAsync()

Completes when the child process exits.

public Task WaitForExitAsync()

Returns

Task

WaitForReadyAsync(CancellationToken)

Completes once the connection is Ready (waiting through any in-progress restart); faults only once the connection is terminally Exited.

public Task WaitForReadyAsync(CancellationToken token)

Parameters

token CancellationToken

Cancels the wait.

Returns

Task

WaitForTerminalAsync()

Completes once the connection is terminally Exited (restart, if any, exhausted).

public Task WaitForTerminalAsync()

Returns

Task

Events

StateChanged

Raised on every state transition.

public event Action<ConnectionState>? StateChanged

Event Type

Action<ConnectionState>