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
serverProcessIRDCoreServerProcesstransportLayerILanguageServerProtocolTransportLayerloggerILogger<ChildConnection>
Properties
Client
The live language client. Throws until the connection is Ready.
public ILanguageClient Client { get; }
Property Value
PlatformInfo
The result of the rdcore/platform/initialize handshake, once the connection is Ready.
public PlatformInitializeResult? PlatformInfo { get; }
Property Value
State
The current lifecycle state of the connection.
public ConnectionState State { get; }
Property Value
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
requestChildConnectionRequestThe connection inputs.
tokenCancellationTokenCancels the connection attempt.
Returns
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
notificationTParamsThe notification parameters.
tokenCancellationTokenCancels before the notification is sent.
Returns
Type Parameters
TParamsThe 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
requestTParamsThe request parameters.
tokenCancellationTokenCancels the request.
Returns
- Task<TResult>
Type Parameters
TParamsThe request parameter type.
TResultThe 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
WaitForExitAsync()
Completes when the child process exits.
public Task WaitForExitAsync()
Returns
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
tokenCancellationTokenCancels the wait.
Returns
WaitForTerminalAsync()
Completes once the connection is terminally Exited (restart, if any, exhausted).
public Task WaitForTerminalAsync()
Returns
Events
StateChanged
Raised on every state transition.
public event Action<ConnectionState>? StateChanged