@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface SettingsAccessor<T>

    Scope-aware, validated access to one configuration section.

    The accessor owns one internal platform subscription and must be disposed. The Application container normally owns that lifetime. Registrations returned by onDidChange and watch are caller-owned.

    interface SettingsAccessor<T extends object> {
        dispose(): void;
        inspect<K extends string | number | symbol>(
            key: K,
            scope?: SettingsScope,
        ): SettingsInspection<T[K]> | undefined;
        onDidChange(
            listener: (event: SettingsChangeEvent<T>) => void,
        ): PlatformRegistration;
        read(scope?: SettingsScope): SettingsSnapshot<T>;
        update<K extends string | number | symbol>(
            key: K,
            value: T[K] | undefined,
            target: SettingsTarget,
            scope?: SettingsScope,
            overrideInLanguage?: boolean,
        ): Promise<void>;
        watch<K extends string | number | symbol>(
            key: K,
            scope: SettingsScope | undefined,
            listener: (value: T[K]) => void,
        ): PlatformRegistration;
    }

    Type Parameters

    • T extends object
    Index
    • Releases the accessor's own change subscription.

      The container owns accessors and calls this during shutdown; application code does not need to. This does not dispose subscriptions previously returned to callers by onDidChange or watch.

      Returns void

    • Writes one setting and invalidates the unscoped cache after the platform update succeeds. Passing undefined removes the target tier's value.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns Promise<void>

    • Watches a single setting, invoking the listener with its new effective value whenever a change affects it.

      Only this key is read, and the listener fires only when the value actually changed — a change to a sibling key in the same section affects the section but not this value. Under strict policy an invalid new value is logged and the listener keeps the previous one rather than throwing from inside the platform's event dispatch. The watch is seeded on the first relevant change and does not invoke the listener during registration. The returned registration is caller-owned; listener exceptions follow the platform event emitter's rules.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      Returns PlatformRegistration

      const subscription = settings.watch('enabled', scope, (enabled) => {
      toggleFeature(enabled);
      });