Table of Contents

Interface ILiveSettings

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

The settings a component was given by its client that take effect while it runs (Live), and what it hands down to the components it is the client of.

public interface ILiveSettings

Remarks

A client says what its user set (LSP 3.17 §Configuration Request): the server asks with workspace/configuration, when it is initialized and whenever the client says something changed (workspace/didChangeConfiguration). The settings travel as a configuration section (LiveSettingsProtocol): the keys under Root, separated by :, as text - Server:Verbose is False.

Of what a client says, the live settings this component has (LiveSettingsTarget) are set on its settings objects, a value a setting cannot be left out; a live setting the client says nothing of takes the value it had when the component started back. A setting that is not live is not set: it is read when a component starts, from what its user set (UserSettingsStore). What is said of a setting this component does not have is another component's, and is handed down as it is.

A component no client has said anything to - the shell, which is the client of the others - hands down what its user set, as the user's settings say it now.

Properties

Current

What this component hands down to the components it is the client of: what its own client said, or - before that, and in a component that has no client - the live settings its user set, as the user's settings say them now. The keys are under Root, separated by :.

IReadOnlyDictionary<string, string> Current { get; }

Property Value

IReadOnlyDictionary<string, string>

HasReceived

Whether the client has said what its settings are: Apply(IReadOnlyDictionary<string, string>) was called.

bool HasReceived { get; }

Property Value

bool

Said

What the client said its user set, without what the component took for a setting the user did not set (the editor's tab size, FormattingTabSize); in a component that has no client, or before its client said anything, the live settings its user set.

IReadOnlyDictionary<string, string> Said { get; }

Property Value

IReadOnlyDictionary<string, string>

Methods

Apply(IReadOnlyDictionary<string, string>)

Takes what the client said the settings are, and sets the live ones on the settings objects.

void Apply(IReadOnlyDictionary<string, string> settings)

Parameters

settings IReadOnlyDictionary<string, string>

The settings, by their keys under Root, separated by :.

Apply(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>)

Takes what the client said the settings are, and the settings the component takes for the ones the client did not say, and sets the live ones on the settings objects.

void Apply(IReadOnlyDictionary<string, string> said, IReadOnlyDictionary<string, string> adopted)

Parameters

said IReadOnlyDictionary<string, string>

What the client said, by the keys under Root, separated by :: Said.

adopted IReadOnlyDictionary<string, string>

What the component takes besides, for settings the client did not say.

Apply(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>, Func<bool>)

Takes what the client said as the overload above does, if isCurrent says it is still what is to be taken. The check and the setting are one step; Changed is raised after it, with no lock held. The listeners may be told by another thread, when it is telling the changes before this one.

bool Apply(IReadOnlyDictionary<string, string> said, IReadOnlyDictionary<string, string> adopted, Func<bool> isCurrent)

Parameters

said IReadOnlyDictionary<string, string>

What the client said.

adopted IReadOnlyDictionary<string, string>

What the component takes besides.

isCurrent Func<bool>

Asked once the settings are about to be set, with nothing else setting them; it must not wait for anything that waits for these settings.

Returns

bool

Whether the settings were set.

ApplyAsync(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>, Func<bool>)

Takes what the client said as Apply(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>, Func<bool>) does, and completes once the listeners of Changed were told of this change - by this thread, or by the one that was telling the changes before it.

Task<bool> ApplyAsync(IReadOnlyDictionary<string, string> said, IReadOnlyDictionary<string, string> adopted, Func<bool> isCurrent)

Parameters

said IReadOnlyDictionary<string, string>

What the client said.

adopted IReadOnlyDictionary<string, string>

What the component takes besides.

isCurrent Func<bool>

Asked once the settings are about to be set, with nothing else setting them; it must not wait for anything that waits for these settings.

Returns

Task<bool>

Whether the settings were set, once they were told to the listeners; false at once when they were not set.

Remarks

Nothing waits for a thread: the task completes when the thread that tells the changes comes to this one. A listener that sets settings itself, on the thread that tells it, gets a task that completes after it has returned; it must not wait for that task.

Refresh()

Sets the live settings on the settings objects as the user's settings say them now: what a component that is no other's server does when its user changes a setting.

void Refresh()

Events

Changed

Raised once the live settings were set again: once for each change, in the order the changes were made, and never by two threads at once. A listener that throws is logged, and the others are told all the same.

event EventHandler? Changed

Event Type

EventHandler