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

    Function defineStorage

    • Declares a typed, versioned storage.

      The definition doubles as the service token for its accessor, so a handler injects storage the same way it injects anything else.

      Type Parameters

      • T

      Parameters

      Returns StorageDefinition<T>

      export const UserPreferences = defineStorage({
      key: 'preferences',
      scope: 'global',
      version: 2,
      defaultValue: { theme: 'dark' },
      migrations: { 1: (old) => ({ ...(old as object), theme: 'dark' }) },
      syncable: true,
      });

      module.storage.add(UserPreferences);

      module.commands.handle(Refresh, {
      inject: { preferences: UserPreferences.token },
      execute: (context, _args, { preferences }) => preferences.get().theme,
      });