Options
All
  • Public
  • Public/Protected
  • All
Menu

An interface for manipulating the settings of a specific plugin.

Hierarchy

  • IDisposable
    • ISettings

Implemented by

Index

Properties

Readonly changed

changed: ISignal<ISettings, void>

A signal that emits when the plugin's settings have changed.

Readonly composite

composite: ReadonlyPartialJSONObject

The composite of user settings and extension defaults.

Readonly id

id: string

The plugin's ID.

Readonly isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

Readonly plugin

plugin: IPlugin

Readonly raw

raw: string

The plugin settings raw text value.

Readonly schema

schema: ISchema

The plugin's schema.

Readonly user

user: ReadonlyPartialJSONObject

The user settings.

Readonly version

version: string

The published version of the NPM package containing these settings.

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 resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    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.

    • 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: PartialJSONValue): Promise<void>
  • Set a single setting.

    Parameters

    • key: string

      The name of the setting being set.

    • value: PartialJSONValue

      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