import { IStringDictionary } from '../../../base/common/collections.js'; import { Event } from '../../../base/common/event.js'; import { URI, UriComponents } from '../../../base/common/uri.js'; import { IWorkspaceFolder } from '../../workspace/common/workspace.js'; export declare const IConfigurationService: import("../../instantiation/common/instantiation.js").ServiceIdentifier; export interface IConfigurationOverrides { overrideIdentifier?: string | null; resource?: URI | null; } export type IConfigurationUpdateOverrides = Omit & { overrideIdentifiers?: string[] | null; }; export declare enum ConfigurationTarget { APPLICATION = 1, USER = 2, USER_LOCAL = 3, USER_REMOTE = 4, WORKSPACE = 5, WORKSPACE_FOLDER = 6, DEFAULT = 7, MEMORY = 8 } export interface IConfigurationChange { keys: string[]; overrides: [string, string[]][]; } export interface IConfigurationChangeEvent { readonly source: ConfigurationTarget; readonly affectedKeys: ReadonlySet; readonly change: IConfigurationChange; affectsConfiguration(configuration: string, overrides?: IConfigurationOverrides): boolean; } export interface IInspectValue { readonly value?: T; readonly override?: T; readonly overrides?: { readonly identifiers: string[]; readonly value: T; }[]; } export interface IConfigurationValue { readonly defaultValue?: T; readonly applicationValue?: T; readonly userValue?: T; readonly userLocalValue?: T; readonly userRemoteValue?: T; readonly workspaceValue?: T; readonly workspaceFolderValue?: T; readonly memoryValue?: T; readonly policyValue?: T; readonly value?: T; readonly default?: IInspectValue; readonly application?: IInspectValue; readonly user?: IInspectValue; readonly userLocal?: IInspectValue; readonly userRemote?: IInspectValue; readonly workspace?: IInspectValue; readonly workspaceFolder?: IInspectValue; readonly memory?: IInspectValue; readonly policy?: { value?: T; }; readonly overrideIdentifiers?: string[]; } export interface IConfigurationUpdateOptions { /** * If `true`, do not notifies the error to user by showing the message box. Default is `false`. */ donotNotifyError?: boolean; /** * How to handle dirty file when updating the configuration. */ handleDirtyFile?: 'save' | 'revert'; } export interface IConfigurationService { readonly _serviceBrand: undefined; onDidChangeConfiguration: Event; getConfigurationData(): IConfigurationData | null; /** * Fetches the value of the section for the given overrides. * Value can be of native type or an object keyed off the section name. * * @param section - Section of the configuration. Can be `null` or `undefined`. * @param overrides - Overrides that has to be applied while fetching * */ getValue(): T; getValue(section: string): T; getValue(overrides: IConfigurationOverrides): T; getValue(section: string, overrides: IConfigurationOverrides): T; /** * Update a configuration value. * * Use `target` to update the configuration in a specific `ConfigurationTarget`. * * Use `overrides` to update the configuration for a resource or for override identifiers or both. * * Passing a resource through overrides will update the configuration in the workspace folder containing that resource. * * *Note 1:* Updating configuration to a default value will remove the configuration from the requested target. If not target is passed, it will be removed from all writeable targets. * * *Note 2:* Use `undefined` value to remove the configuration from the given target. If not target is passed, it will be removed from all writeable targets. * * Use `donotNotifyError` and set it to `true` to surpresss errors. * * @param key setting to be updated * @param value The new value */ updateValue(key: string, value: any): Promise; updateValue(key: string, value: any, target: ConfigurationTarget): Promise; updateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides): Promise; updateValue(key: string, value: any, overrides: IConfigurationOverrides | IConfigurationUpdateOverrides, target: ConfigurationTarget, options?: IConfigurationUpdateOptions): Promise; inspect(key: string, overrides?: IConfigurationOverrides): IConfigurationValue>; reloadConfiguration(target?: ConfigurationTarget | IWorkspaceFolder): Promise; keys(): { default: string[]; user: string[]; workspace: string[]; workspaceFolder: string[]; memory?: string[]; }; } export interface IConfigurationModel { contents: any; keys: string[]; overrides: IOverrides[]; raw?: IStringDictionary; } export interface IOverrides { keys: string[]; contents: any; identifiers: string[]; } export interface IConfigurationData { defaults: IConfigurationModel; policy: IConfigurationModel; application: IConfigurationModel; userLocal: IConfigurationModel; userRemote: IConfigurationModel; workspace: IConfigurationModel; folders: [UriComponents, IConfigurationModel][]; } export interface IConfigurationCompareResult { added: string[]; removed: string[]; updated: string[]; overrides: [string, string[]][]; } export declare function toValuesTree(properties: { [qualifiedKey: string]: any; }, conflictReporter: (message: string) => void): any; export declare function addToValueTree(settingsTreeRoot: any, key: string, value: any, conflictReporter: (message: string) => void): void; export declare function removeFromValueTree(valueTree: any, key: string): void; /** * A helper function to get the configuration value with a specific settings path (e.g. config.some.setting) */ export declare function getConfigurationValue(config: any, settingPath: string): T | undefined; export declare function getConfigurationValue(config: any, settingPath: string, defaultValue: T): T; export declare function getLanguageTagSettingPlainKey(settingKey: string): string;