Skip to main content

Module transfer

Module transfer 

Source
Expand description

Settings export and import: the file a person writes their settings to and reads them back from, and the plan an import shows before it applies (one row per setting: what it is now, what the file says, and whether it would change, stay, or be left out and why).

The file is a JSON document (ADR 0008) of kind settings-export, version 1:

{
  "kind": "settings-export",
  "version": 1,
  "app": "my-app",
  "selection": { "layer": "app", "place": "interface" },
  "settings": { "version": 3, "values": { "appearance.theme": "dark" } },
  "shortcuts": { "version": 3, "bindings": [{ "keys": "Ctrl+K", "command": "palette.open" }] },
  "leftOut": ["sync.token"]
}
  • settings.values is by setting id; settings.version is the version of the settings document they were written at, so an import migrates them as the settings file is (a retired choice read as the one that replaced it).
  • shortcuts (optional) is the person’s keymap layer, with the keymap document’s version.
  • leftOut lists the sensitive settings that were not written (Descriptor::sensitive); their values are never in the file.
  • app and selection say where it comes from and what was chosen; an import reads them for its words only.

The plan (plan) judges each value against the setting this application declares: a value that changes (Verdict::Change), one equal to the current (Verdict::Same), a setting not declared here (Verdict::Unknown), one the application retired (Verdict::Obsolete), a value of the wrong type or out of range (Verdict::Invalid, never clamped), and a sensitive setting (Verdict::Sensitive, never read from a file).

Structs§

Declared
What a plan needs of a setting this application declares.
Row
One row of an import’s plan.
SettingsFile
A settings export.
Shortcuts
A keymap layer, at a keymap document version.
Values
The settings’ values, by id, at a settings document version.

Enums§

Verdict
What an import does with one value.

Constants§

KIND
The document’s kind.
SHORTCUTS
The key of the shortcuts’ row in a plan.
VERSION
The document’s version.

Functions§

plan
Judges each value of a file against the settings declared here (declared) and those retired (obsolete, with what replaced them). The rows are in the file’s order (by id); the sensitive settings the file left out come last.
schema
The settings-export document’s schema.
without_secrets
Splits values to export: the sensitive ones are left out, by id.