import { Emitter, Event } from '../../../base/common/event'; import { Disposable } from '../../../base/common/lifecycle'; import { URI, UriDto } from '../../../base/common/uri'; import { IEnvironmentService } from '../../../platform/environment/common/environment'; import { IFileService } from '../../../platform/files/common/files'; import { ILogService } from '../../../platform/log/common/log'; import { IAnyWorkspaceIdentifier } from '../../../platform/workspace/common/workspace'; import { ResourceMap } from '../../../base/common/map'; import { IStringDictionary } from '../../../base/common/collections'; import { IUriIdentityService } from '../../../platform/uriIdentity/common/uriIdentity'; export declare const enum ProfileResourceType { Settings = "settings", Keybindings = "keybindings", Snippets = "snippets", Tasks = "tasks", Extensions = "extensions", GlobalState = "globalState" } /** * Flags to indicate whether to use the default profile or not. */ export type UseDefaultProfileFlags = { [key in ProfileResourceType]?: boolean; }; export interface IUserDataProfile { readonly id: string; readonly isDefault: boolean; readonly name: string; readonly shortName?: string; readonly icon?: string; readonly location: URI; readonly globalStorageHome: URI; readonly settingsResource: URI; readonly keybindingsResource: URI; readonly tasksResource: URI; readonly snippetsHome: URI; readonly extensionsResource: URI; readonly cacheHome: URI; readonly useDefaultFlags?: UseDefaultProfileFlags; readonly isTransient?: boolean; } export declare function isUserDataProfile(thing: unknown): thing is IUserDataProfile; export type DidChangeProfilesEvent = { readonly added: readonly IUserDataProfile[]; readonly removed: readonly IUserDataProfile[]; readonly updated: readonly IUserDataProfile[]; readonly all: readonly IUserDataProfile[]; }; export type WillCreateProfileEvent = { profile: IUserDataProfile; join(promise: Promise): void; }; export type WillRemoveProfileEvent = { profile: IUserDataProfile; join(promise: Promise): void; }; export interface IUserDataProfileOptions { readonly shortName?: string; readonly icon?: string; readonly useDefaultFlags?: UseDefaultProfileFlags; readonly transient?: boolean; } export interface IUserDataProfileUpdateOptions extends Omit { readonly name?: string; readonly icon?: string | null; } export declare const IUserDataProfilesService: import("../../../platform/instantiation/common/instantiation").ServiceIdentifier; export interface IUserDataProfilesService { readonly _serviceBrand: undefined; readonly profilesHome: URI; readonly defaultProfile: IUserDataProfile; readonly onDidChangeProfiles: Event; readonly profiles: readonly IUserDataProfile[]; readonly onDidResetWorkspaces: Event; isEnabled(): boolean; createNamedProfile(name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; createTransientProfile(workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; updateProfile(profile: IUserDataProfile, options?: IUserDataProfileUpdateOptions): Promise; removeProfile(profile: IUserDataProfile): Promise; setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profile: IUserDataProfile): Promise; resetWorkspaces(): Promise; cleanUp(): Promise; cleanUpTransientProfiles(): Promise; } export declare function reviveProfile(profile: UriDto, scheme: string): IUserDataProfile; export declare function toUserDataProfile(id: string, name: string, location: URI, profilesCacheHome: URI, options?: IUserDataProfileOptions, defaultProfile?: IUserDataProfile): IUserDataProfile; export type UserDataProfilesObject = { profiles: IUserDataProfile[]; workspaces: ResourceMap; emptyWindows: Map; }; export type StoredUserDataProfile = { name: string; location: URI; shortName?: string; icon?: string; useDefaultFlags?: UseDefaultProfileFlags; }; export type StoredProfileAssociations = { workspaces?: IStringDictionary; emptyWindows?: IStringDictionary; }; export declare class UserDataProfilesService extends Disposable implements IUserDataProfilesService { protected readonly environmentService: IEnvironmentService; protected readonly fileService: IFileService; protected readonly uriIdentityService: IUriIdentityService; protected readonly logService: ILogService; protected static readonly PROFILES_KEY = "userDataProfiles"; protected static readonly PROFILE_ASSOCIATIONS_KEY = "profileAssociations"; readonly _serviceBrand: undefined; protected enabled: boolean; readonly profilesHome: URI; private readonly profilesCacheHome; get defaultProfile(): IUserDataProfile; get profiles(): IUserDataProfile[]; protected readonly _onDidChangeProfiles: Emitter; readonly onDidChangeProfiles: Event; protected readonly _onWillCreateProfile: Emitter; readonly onWillCreateProfile: Event; protected readonly _onWillRemoveProfile: Emitter; readonly onWillRemoveProfile: Event; private readonly _onDidResetWorkspaces; readonly onDidResetWorkspaces: Event; private profileCreationPromises; protected readonly transientProfilesObject: UserDataProfilesObject; constructor(environmentService: IEnvironmentService, fileService: IFileService, uriIdentityService: IUriIdentityService, logService: ILogService); init(): void; setEnablement(enabled: boolean): void; isEnabled(): boolean; protected _profilesObject: UserDataProfilesObject | undefined; protected get profilesObject(): UserDataProfilesObject; private createDefaultProfile; createTransientProfile(workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; createNamedProfile(name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise; private doCreateProfile; updateProfile(profileToUpdate: IUserDataProfile, options: IUserDataProfileUpdateOptions): Promise; removeProfile(profileToRemove: IUserDataProfile): Promise; setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profileToSet: IUserDataProfile): Promise; unsetWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, transient?: boolean): void; resetWorkspaces(): Promise; cleanUp(): Promise; cleanUpTransientProfiles(): Promise; getProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier): IUserDataProfile | undefined; protected getWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier): URI | string; private isProfileAssociatedToWorkspace; private updateProfiles; protected triggerProfilesChanges(added: IUserDataProfile[], removed: IUserDataProfile[], updated: IUserDataProfile[]): void; private updateWorkspaceAssociation; private updateStoredProfileAssociations; protected migrateStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): StoredProfileAssociations; protected getStoredProfiles(): StoredUserDataProfile[]; protected saveStoredProfiles(storedProfiles: StoredUserDataProfile[]): void; protected getStoredProfileAssociations(): StoredProfileAssociations; protected saveStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): void; protected getDefaultProfileExtensionsLocation(): URI | undefined; } export declare class InMemoryUserDataProfilesService extends UserDataProfilesService { private storedProfiles; protected getStoredProfiles(): StoredUserDataProfile[]; protected saveStoredProfiles(storedProfiles: StoredUserDataProfile[]): void; private storedProfileAssociations; protected getStoredProfileAssociations(): StoredProfileAssociations; protected saveStoredProfileAssociations(storedProfileAssociations: StoredProfileAssociations): void; }