Settings Docs (draft) Help

Overview

A Settings Controller is a service that encapsulates both the persistence and calculation of individual values. Each setting is represented by a distinct key.

The Settings Controller returns a calculated value corresponding to a given key. A "calculated" value means that the actual value is computed based on the setting value derived from all participating sources.

ClientSettings Controller MediatorFirst Settings ControllerNth Settings ControllerXML filesDatabaseCustom Source

SettingsController

DelegatedSettingsController

getItemsetItemDelegate the requestto the next controller if needed

The order of the extensions defines the sequence in which the controllers are processed. The mediator continues to process these controllers until a result is resolved.

Use Cases

UserServiceSettingsControllerRemote DevTBECloud Envsuspend fun <T : AnygetItem(key: SettingDescriptor<T>): T? suspend fun <T : AnysetItem(key: SettingDescriptor<T>, value: T?)suspend fun <T : Any> getItem(key: SettingDescriptor<T>): T? suspend fun <T : Any> setItem(key: SettingDescriptor<T>, value: T?)Client and HostProcess Per Connection InteractsSync settings both waysMerge settings from local config dir and remote host settingsEnforce settings from a predefined profileForbid some settings (e.g. keychain)

Remote Dev

To ensure that a network request isn't performed for each setting, a setting storage blob may initially be prepared and sent to the remote setting controller. The default IJ Platform local setting controller is designed with that in mind.

Process per Connection

Local Only. We do not want to clone the configuration directory for each connection. The same configuration directory is reused for all clients.

TBE

  • Set or get a specific setting (instead of only operating at the container level).

  • Access settings without needing to know the implementation details of a container through a key-value API (see RawSettingSerializerDescriptor).

  • Prevent certain keys from being set by the user (making them read-only settings). See Mutability.

  • Intercept the events that signal a setting has been modified.

  • Instruct to use the "default" value for a certain key.

Service

A service is an entity that implements specific IDE functionality. The Settings API, replacing the previous PropertiesComponent, can be used anywhere a suspend context is available.

Still, the term Service is chosen specifically, advocating that ideally, all code should be implemented as a service.

Last modified: 10 March 2024