Options
All
  • Public
  • Public/Protected
  • All
Menu

A manager for a specific plugin's settings.

Hierarchy

  • Settings

Implements

Index

Constructors

constructor

  • Instantiate a new plugin settings manager.

    Parameters

    Returns Settings

Properties

Private _changed

_changed: any

Private _isDisposed

_isDisposed: any

Private _onPluginChanged

_onPluginChanged: any

Handle plugin changes in the setting registry.

Readonly id

id: string

The plugin name.

Readonly registry

The setting registry instance used as a back-end for these settings.

Accessors

changed

  • get changed(): ISignal<this, void>
  • A signal that emits when the plugin's settings have changed.

    Returns ISignal<this, void>

composite

  • get composite(): ReadonlyPartialJSONObject
  • The composite of user settings and extension defaults.

    Returns ReadonlyPartialJSONObject

isDisposed

  • get isDisposed(): boolean
  • Test whether the plugin settings manager disposed.

    Returns boolean

plugin

  • Returns IPlugin

raw

  • get raw(): string
  • The plugin settings raw text value.

    Returns string

schema

  • The plugin's schema.

    Returns ISchema

user

  • get user(): ReadonlyPartialJSONObject
  • The user settings.

    Returns ReadonlyPartialJSONObject

version

  • get version(): string
  • The published version of the NPM package containing these settings.

    Returns string

Methods

annotatedDefaults

  • annotatedDefaults(): string
  • Return the defaults in a commented JSON format.

    Returns string

default

  • default(key: string): PartialJSONValue
  • Calculate the default value of a setting by iterating through the schema.

    Parameters

    • key: string

      The name of the setting whose default value is calculated.

    Returns PartialJSONValue

    A calculated default JSON value for a specific setting.

dispose

  • dispose(): void
  • Dispose of the plugin settings resources.

    Returns void

get

  • get(key: string): { composite: ReadonlyPartialJSONValue; user: ReadonlyPartialJSONValue }
  • Get an individual setting.

    Parameters

    • key: string

      The name of the setting being retrieved.

    Returns { composite: ReadonlyPartialJSONValue; user: ReadonlyPartialJSONValue }

    The setting value.

    Notes

    This method returns synchronously because it uses a cached copy of the plugin settings that is synchronized with the registry.

    • composite: ReadonlyPartialJSONValue
    • user: ReadonlyPartialJSONValue

remove

  • remove(key: string): Promise<void>
  • Remove a single setting.

    Parameters

    • key: string

      The name of the setting being removed.

    Returns Promise<void>

    A promise that resolves when the setting is removed.

    Notes

    This function is asynchronous because it writes to the setting registry.

save

  • save(raw: string): Promise<void>
  • Save all of the plugin's user settings at once.

    Parameters

    • raw: string

    Returns Promise<void>

set

  • set(key: string, value: JSONValue): Promise<void>
  • Set a single setting.

    Parameters

    • key: string

      The name of the setting being set.

    • value: JSONValue

      The value of the setting.

    Returns Promise<void>

    A promise that resolves when the setting has been saved.

    Notes

    This function is asynchronous because it writes to the setting registry.

validate

  • validate(raw: string): IError[]
  • Validates raw settings with comments.

    Parameters

    • raw: string

      The JSON with comments string being validated.

    Returns IError[]

    A list of errors or null if valid.

Generated using TypeDoc