Theia API Documentation v1.65.0
    Preparing search index...
    interface PreferenceProvider {
        onDidPreferencesChanged: Event<PreferenceProviderDataChanges>;
        ready: Promise<void>;
        canHandleScope(scope: PreferenceScope): boolean;
        dispose(): void;
        get<T>(preferenceName: string, resourceUri?: string): undefined | T;
        getConfigUri?(resourceUri?: string, sectionName?: string): undefined | URI;
        getContainingConfigUri?(
            resourceUri?: string,
            sectionName?: string,
        ): undefined | URI;
        getPreferences(resourceUri?: string): JSONObject;
        resolve<T>(
            preferenceName: string,
            resourceUri?: string,
        ): PreferenceResolveResult<T>;
        setPreference(
            key: string,
            value: JSONValue,
            resourceUri?: string,
        ): Promise<boolean>;
    }

    Hierarchy

    • Disposable
      • PreferenceProvider

    Implemented by

    Index

    Properties

    onDidPreferencesChanged: Event<PreferenceProviderDataChanges>
    ready: Promise<void>

    Methods

    • Dispose this object.

      Returns void

    • Retrieve the stored value for the given preference and resource URI.

      Type Parameters

      • T

      Parameters

      • preferenceName: string

        the preference identifier.

      • OptionalresourceUri: string

        the uri of the resource for which the preference is stored. This is used to retrieve a potentially different value for the same preference for different resources, for example files.encoding.

      Returns undefined | T

      the value stored for the given preference and resourceUri if it exists, otherwise undefined.

    • Retrieve the configuration URI for the given resource URI.

      Parameters

      • OptionalresourceUri: string

        the uri of the resource or undefined.

      • OptionalsectionName: string

        the section to return the URI for, e.g. tasks or launch. Defaults to settings.

      Returns undefined | URI

      the corresponding resource URI or undefined if there is no valid URI.

    • Retrieves the first valid configuration URI contained by the given resource.

      Parameters

      • OptionalresourceUri: string

        the uri of the container resource or undefined.

      • OptionalsectionName: string

      Returns undefined | URI

      the first valid configuration URI contained by the given resource undefined if there is no valid configuration URI at all.

    • Resolve the value for the given preference and resource URI.

      Type Parameters

      • T

      Parameters

      • preferenceName: string

        the preference identifier.

      • OptionalresourceUri: string

        the URI of the resource for which this provider should resolve the preference. This is used to retrieve a potentially different value for the same preference for different resources, for example files.encoding.

      Returns PreferenceResolveResult<T>

      an object containing the value stored for the given preference and resourceUri if it exists, otherwise undefined.

    • Stores a new value for the given preference key in the provider.

      Parameters

      • key: string

        the preference key (typically the name).

      • value: JSONValue

        the new preference value.

      • OptionalresourceUri: string

        the URI of the resource for which the preference is stored.

      Returns Promise<boolean>

      a promise that only resolves if all changes were delivered. If changes were made then implementation must either await on this.emitPreferencesChangedEvent(...) or this.pendingChanges if changes are fired indirectly.