Table of Contents

Class RDCoreServerApp

Namespace
RDCore.SDK.Server
Assembly
RDCore.SDK.dll

A server-side (LSP) RDCore app.

public abstract class RDCoreServerApp : IRDCoreServerApp, IRDCoreApp, IDisposable
Inheritance
RDCoreServerApp
Implements
Derived
Inherited Members

Remarks

🧩 Since RDCore extensions are LSP servers, this is the base class for most RDCore applications.

Constructors

RDCoreServerApp(IOptions<SdkAppOptions>, IServerStateProvider, IHealthCheckService<RDCoreServerApp>, ILanguageServerProtocolTransportLayer, ILogger<RDCoreServerApp>)

A server-side (LSP) RDCore app.

protected RDCoreServerApp(IOptions<SdkAppOptions> options, IServerStateProvider serverStateProvider, IHealthCheckService<RDCoreServerApp> healthCheckService, ILanguageServerProtocolTransportLayer transportLayer, ILogger<RDCoreServerApp> logger)

Parameters

options IOptions<SdkAppOptions>

The current server configuration options.

serverStateProvider IServerStateProvider

Manages the operational state of the server application.

healthCheckService IHealthCheckService<RDCoreServerApp>

A service that monitors the server process.

transportLayer ILanguageServerProtocolTransportLayer

The RDCore/LSP transport layer.

logger ILogger<RDCoreServerApp>

A standard logger.

Remarks

🧩 Since RDCore extensions are LSP servers, this is the base class for most RDCore applications.

Properties

DocumentSelector

The documents the server's handlers of a document's notifications (textDocument/didOpen, didChange, didClose) are registered for; null for a server that serves none.

protected virtual TextDocumentSelector? DocumentSelector { get; }

Property Value

TextDocumentSelector

Remarks

A client may send a notification about a document the server does not serve - a README.md it opens - which OmniSharp hands to no handler. The selector is registered for the handlers, and says which changes are waited for (Serve(Func<Uri, bool>)): one that no handler applies would be waited for forever.

ExternalServices

The external (host) service provider, as opposed to the OmniSharp language server's internal Services.

protected IServiceProvider ExternalServices { get; }

Property Value

IServiceProvider

Remarks

👉 Platform services such as IPlatformCompositionService and the orchestration services are registered here, not on the internal server container. Server apps that bring up child components must pass this provider to RunAsync(IServiceProvider, string[]).

PlatformComponent

Identifies the type of RDCore platform application.

public abstract CoreServerComponent PlatformComponent { get; }

Property Value

CoreServerComponent

ServerStateProvider

protected IServerStateProvider ServerStateProvider { get; }

Property Value

IServerStateProvider

Methods

BeforeRunAsync(string[])

protected virtual Task BeforeRunAsync(string[] args)

Parameters

args string[]

Returns

Task

ClientAnswersDuringInitialize(InitializeParams)

Whether the client of an initialize request answers what the server asks its user before the request is answered (AnswersDuringInitialize): it says it does, and does not run unattended.

protected static bool ClientAnswersDuringInitialize(InitializeParams request)

Parameters

request InitializeParams

The request.

Returns

bool

Remarks

A server asks nothing while it answers initialize of a client this is false for: it would wait for an answer that does not come, and the client for the answer to initialize.

ClientLanguage(InitializeParams)

The language the client of an initialize request says the workspace is written in (Language), when it names one the platform serves.

protected static SupportedLanguage? ClientLanguage(InitializeParams request)

Parameters

request InitializeParams

The request.

Returns

SupportedLanguage

The language, or null when the client names none, or one the platform does not serve.

Remarks

What the client names is already the server's setting when the server's own handler runs. A server that can tell the language from the workspace itself, such as from its project file (OfProject(RDCoreProject)), asks this first: what the client names wins.

ClientRunsUnattended(InitializeParams)

Whether the client of an initialize request says nobody is there to answer what the server would ask its user (Unattended).

protected static bool ClientRunsUnattended(InitializeParams request)

Parameters

request InitializeParams

The request.

Returns

bool

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 language server's internal service collection.

protected virtual void ConfigureServices(IServiceCollection services)

Parameters

services IServiceCollection

The OmniSharp language server's internal service collection.

Remarks

🧩 Register here the dependencies required by any handler configured in ConfigureHandlers(IRDCoreLSPHandlerConfigurationBuilder). The base implementation does nothing.

Dispose()

Disposes of any unmanaged resources held at instance level.

public void Dispose()

Dispose(bool)

Disposes of any unmanaged resources held at instance level.

protected abstract void Dispose(bool disposing)

Parameters

disposing bool

GetServerInfo()

Gets information about this LSP server application and its configuration.

protected virtual ServerInfo GetServerInfo()

Returns

ServerInfo

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 ServerInfo needs.

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.

OnLanguageServerInitializeAsync(ILanguageServer, InitializeParams, CancellationToken)

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

protected virtual Task OnLanguageServerInitializeAsync(ILanguageServer server, InitializeParams request, CancellationToken cancellationToken)

Parameters

server ILanguageServer
request InitializeParams
cancellationToken CancellationToken

Returns

Task

Remarks

🧩 The base implementation simply logs handler completion at Trace level. This method runs after server capabilities registration .

OnLanguageServerInitializedAsync(ILanguageServer, InitializeParams, InitializeResult, CancellationToken)

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

protected virtual Task OnLanguageServerInitializedAsync(ILanguageServer server, InitializeParams request, InitializeResult response, CancellationToken cancellationToken)

Parameters

server ILanguageServer
request InitializeParams
response InitializeResult
cancellationToken CancellationToken

Returns

Task

Remarks

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

OnLanguageServerStarted(ILanguageServer)

🚀 LSP initialization has completed, server is ready to start receiving and responding to client requests and notifications.

protected virtual void OnLanguageServerStarted(ILanguageServer server)

Parameters

server ILanguageServer

Remarks

The client owns the file system for any document that is currently opened.
❌ DO NOT configure any server-side FileSystemWatcher.

OnLiveSettingsChangedAsync(ILanguageServer)

The client said the live settings changed, and they were set on the component's settings (ILiveSettings).

protected virtual Task OnLiveSettingsChangedAsync(ILanguageServer server)

Parameters

server ILanguageServer

The language server.

Returns

Task

Remarks

🧩 The base implementation does nothing. A server that is the client of other components says so to them - they ask it, as it asked its own client - and one that diagnoses documents asks its client to pull its diagnostics again.

OnServerStoppingAsync()

Invoked when the server has been asked to stop, concurrently with its own teardown. Override to gracefully shut down any supervised child components. Base implementation does nothing.

protected virtual Task OnServerStoppingAsync()

Returns

Task

RegisterServerCapabilities(ILanguageServer, ClientCapabilities)

Registers the capabilities of this LSP server application, using the provided ClientCapabilities.

protected abstract void RegisterServerCapabilities(ILanguageServer server, ClientCapabilities clientCapabilities)

Parameters

server ILanguageServer

The initializing OmniSharp LSP server instance.

clientCapabilities ClientCapabilities

The client capabilities reported by the client.

Remarks

🧩 This method is invoked during the initialization handshake when the client emits its capabilities in an InitializeParams (LSP Initialize request).

RunAsync(IServiceProvider, string[])

Bootstraps and starts the application.

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

Parameters

externalServiceProvider IServiceProvider
args string[]

The command-line arguments the application was started with.

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