Table of Contents

Class RDCoreClientApp

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

A client-side (LSP) RDCore app.

public abstract class RDCoreClientApp : IRDCoreClientApp, IRDCoreApp, IDisposable
Inheritance
RDCoreClientApp
Implements
Inherited Members

Remarks

🧩 Most RDCore apps are server-side, but if you were making an IDE or a CLI app, this would be your LSP app.

Constructors

RDCoreClientApp(IOptions<SdkAppOptions>, IChildConnectionFactory, ILogger<RDCoreClientApp>)

Creates the app.

protected RDCoreClientApp(IOptions<SdkAppOptions> options, IChildConnectionFactory connectionFactory, ILogger<RDCoreClientApp> logger)

Parameters

options IOptions<SdkAppOptions>

The options of the application.

connectionFactory IChildConnectionFactory

Creates the ChildConnection to the child server.

logger ILogger<RDCoreClientApp>

A standard logger.

Properties

AnswersDuringInitialize

Whether this client answers what the language server asks its user before initialize is answered (window/showMessageRequest), with a choice or with none, and never with an error (AnswersDuringInitialize).

protected virtual bool AnswersDuringInitialize { get; }

Property Value

bool

Remarks

🧩 The base implementation says it does not: a client that has no handler for the request answers it with an error, which the language client this one is built on holds until it is initialized, and the server is not asked to wait for it. A client that answers, and is there to, overrides this; one that runs unattended says it does not, whatever this says.

Channel

The connection to the server as a channel of the platform protocol: what RDCorePlatformClient speaks through, as any client of the platform does. Throws until the connection is ready.

public IRDCorePlatformChannel Channel { get; }

Property Value

IRDCorePlatformChannel

Connection

The connection to the child server. Throws before RunAsync(IServiceProvider, string[]).

protected ChildConnection Connection { get; }

Property Value

ChildConnection

ExtensionInfo

The extension manifest for this Extension component.

public ExtensionInfo? ExtensionInfo { get; init; }

Property Value

ExtensionInfo

PlatformComponent

The type of platform client.

public abstract CoreServerComponent PlatformComponent { get; }

Property Value

CoreServerComponent

Remarks

If Extension, ExtensionInfo should not be null.

PlatformInfo

The result of the rdcore/platform/initialize handshake; null until the connection is Ready.

public PlatformInitializeResult? PlatformInfo { get; }

Property Value

PlatformInitializeResult

SupportsWorkDoneProgress

Whether this client shows the progress of the server's work (window.workDoneProgress): a client that does says so in its capabilities, tracks the work the server begins of its own (window/workDoneProgress/create), and gives a token to the requests it makes the progress of tracked (TrackWorkDone()). The base implementation does not.

protected virtual bool SupportsWorkDoneProgress { get; }

Property Value

bool

WorkProgress

The work the server reports the progress of to this client (LSP 3.17 §Work Done Progress): the work it begins of its own, and the work it does for a request given a token by TrackWorkDone(). Nothing is ever tracked for a client that does not support progress (SupportsWorkDoneProgress).

public WorkProgressTracker WorkProgress { get; }

Property Value

WorkProgressTracker

Methods

BeforeRunAsync(string[])

protected virtual Task BeforeRunAsync(string[] args)

Parameters

args string[]

Returns

Task

ConfigureClientCapabilities(ClientCapabilities)

protected abstract ClientCapabilities ConfigureClientCapabilities(ClientCapabilities capabilities)

Parameters

capabilities ClientCapabilities

Returns

ClientCapabilities

ConfigureHandlers(IRDCoreLSPHandlerConfigurationBuilder)

Configures OmniSharp LSP-compliant JSON-RPC handlers for any LSP 3.17 specified protocol event.

protected abstract void ConfigureHandlers(IRDCoreLSPHandlerConfigurationBuilder builder)

Parameters

builder IRDCoreLSPHandlerConfigurationBuilder

A builder that lets you fluently chain repetitive calls.

Remarks

🧩 This method is invoked immediately after configuring ClientInfo and the client/server lifecycle protocol handlers:

  • RDCore.SDK.Server.Handlers.Lifecycle.ShutdownHandler
  • RDCore.SDK.Server.Handlers.Lifecycle.ExitHandler
  • RDCore.SDK.Server.Handlers.Lifecycle.SetTraceHandler
  • RDCore.SDK.Server.Handlers.Platform.PlatformInitializeHandler

ConfigureServices(IServiceCollection)

Configures services with the OmniSharp service collection.

protected abstract void ConfigureServices(IServiceCollection services)

Parameters

services IServiceCollection

The OmniSharp internal service collection.

CreateInitializationOptions()

What this client says of itself in the initializationOptions of the initialize request: the language the workspace is written in, which only the client knows, and which the server needs to know before it builds anything; whether it runs unattended, as it says in the platform handshake that follows (Unattended); and whether it answers what the server asks before that (AnswersDuringInitialize).

protected virtual RDCoreInitializationOptions CreateInitializationOptions()

Returns

RDCoreInitializationOptions

CreateInitializationParams()

protected virtual InitializeParams CreateInitializationParams()

Returns

InitializeParams

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

protected abstract void Dispose(bool disposing)

Parameters

disposing bool

GetClientCapabilities()

protected virtual ClientCapabilities GetClientCapabilities()

Returns

ClientCapabilities

GetClientInfo()

Gets information about this LSP client application and its configuration.

protected virtual ClientInfo GetClientInfo()

Returns

ClientInfo

Remarks

🧩 The base implementation returns the Name of the entry Assembly and its AssemblyDisplayVersion (the informational version, prerelease suffix and +commit build metadata included), which is everything ClientInfo needs.

GetExpectedCapabilities()

The platform capabilities this app expects the child to provide (sent in the platform handshake). The base implementation expects nothing; a server proxy overrides this with the LS's expectations.

protected virtual CorePlatformClientCapabilities GetExpectedCapabilities()

Returns

CorePlatformClientCapabilities

HandleLanguageClientInitializeAsync(ILanguageClient, InitializeParams, CancellationToken)

Gives your class or handler an opportunity to interact with the InitializeParams before it is sent to the server.

protected Task HandleLanguageClientInitializeAsync(ILanguageClient client, InitializeParams request, CancellationToken cancellationToken)

Parameters

client ILanguageClient

The LSP language client.

request InitializeParams

The Initialize request payload.

cancellationToken CancellationToken

A CancellationToken for cooperative cancellation.

Returns

Task

HandleLanguageClientInitializedAsync(ILanguageClient, InitializeParams, InitializeResult, CancellationToken)

Gives your class or handler an opportunity to interact with the InitializeParams and InitializeResult before it is processed by the client.

protected Task HandleLanguageClientInitializedAsync(ILanguageClient client, InitializeParams request, InitializeResult response, CancellationToken cancellationToken)

Parameters

client ILanguageClient
request InitializeParams
response InitializeResult
cancellationToken CancellationToken

Returns

Task

LogIfEnabled(LogLevel, string)

Logs the specified message at the specified level, if logging is enabled at that level.

public void LogIfEnabled(LogLevel logLevel, string message)

Parameters

logLevel LogLevel

The LogLevel for this message.

message string

The log message.

NotifyLiveSettingsChangedAsync(CancellationToken)

Says to the server that the live settings changed (workspace/didChangeConfiguration): it asks for them (workspace/configuration), and is answered with what this component hands down (Current).

public Task NotifyLiveSettingsChangedAsync(CancellationToken token)

Parameters

token CancellationToken

A token that cancels the notification.

Returns

Task

OnConnectionTerminated()

The child server was lost and restart-with-backoff is exhausted. The base implementation stops the host application, which is correct for a standalone client (e.g. rdc.exe). A server that supervises the child (the language server) overrides this and escalates through its own shutdown path instead.

protected virtual void OnConnectionTerminated()

OnLanguageClientInitializeAsync(ILanguageClient, InitializeParams, CancellationToken)

Signals the completion of the Initialize request handler.
👉 Gives your class or handler an opportunity to interact with the InitializeParams before it is sent to the server.

protected virtual Task OnLanguageClientInitializeAsync(ILanguageClient client, InitializeParams request, CancellationToken token)

Parameters

client ILanguageClient

The LSP language client.

request InitializeParams

The Initialize request payload.

token CancellationToken

A CancellationToken for cooperative cancellation.

Returns

Task

Remarks

🧩 This method is invoked at the end of the initialization handshake; the base implementation logs handler completion at Trace level.

OnLanguageClientInitializedAsync(ILanguageClient, InitializeParams, InitializeResult, CancellationToken)

Signals the completion of the Initialized notification handler.
👉 Gives your class or handler an opportunity to interact with the InitializeParams and InitializeResult before it is processed by the client.

protected virtual Task OnLanguageClientInitializedAsync(ILanguageClient client, InitializeParams request, InitializeResult response, CancellationToken cancellationToken)

Parameters

client ILanguageClient
request InitializeParams
response InitializeResult
cancellationToken CancellationToken

Returns

Task

Remarks

🧩 The base implementation logs handler completion at Trace level.

OnLanguageClientStartedAsync(ILanguageClient, CancellationToken)

Gives your class or handler an opportunity to interact with the ILanguageClient after the connection has been established.

protected virtual Task OnLanguageClientStartedAsync(ILanguageClient client, CancellationToken token)

Parameters

client ILanguageClient
token CancellationToken

Returns

Task

Remarks

🧩 The base implementation simply logs handler completion at Trace level.

RunAsync(IServiceProvider, string[])

Bootstraps and starts the application.

public Task RunAsync(IServiceProvider provider, string[] args)

Parameters

provider IServiceProvider

An IServiceProvider to configure the application.

args string[]

The command-line arguments of the application, given to BeforeRunAsync(string[]).

Returns

Task

SendNotificationAsync<TParams>(TParams, CancellationToken)

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

Parameters

notification TParams
token CancellationToken

Returns

Task

Type Parameters

TParams

SendRequestAsync<TParams, TResult>(TParams, CancellationToken)

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

Parameters

request TParams
token CancellationToken

Returns

Task<TResult>

Type Parameters

TParams
TResult

ShutdownAsync()

Gracefully tears down the child connection: LSP shutdown request, exit notification, then a kill fallback.

public Task ShutdownAsync()

Returns

Task

TrackWorkDone()

A token to give a request for the progress of the work done for it (WorkDoneToken), which WorkProgress tracks while the tracking is not disposed.

public WorkDoneTracking TrackWorkDone()

Returns

WorkDoneTracking

The tracking; its Token is null when the client cannot be reported progress to.

WaitForReadyAsync(CancellationToken)

Completes once the connection to the child server is Ready; faults if the connection reaches a terminal state first.

public Task WaitForReadyAsync(CancellationToken token)

Parameters

token CancellationToken

Returns

Task

WaitForTerminalAsync()

Completes once the connection is terminally lost: the child exited and restart-with-backoff was exhausted.

public Task WaitForTerminalAsync()

Returns

Task