diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index c066fe588f3..b52ad7e31b2 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -69,6 +69,7 @@ import { FilePolicyService } from 'vs/platform/policy/common/filePolicyService'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService'; +import { PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; /** * The main VS Code entry point. @@ -234,8 +235,8 @@ class CodeMain { return instanceEnvironment; } - private initServices(environmentMainService: IEnvironmentMainService, userDataProfilesMainService: UserDataProfilesMainService, configurationService: ConfigurationService, stateMainService: StateMainService): Promise { - return Promises.settled([ + private async initServices(environmentMainService: IEnvironmentMainService, userDataProfilesMainService: UserDataProfilesMainService, configurationService: ConfigurationService, stateMainService: StateMainService): Promise { + await Promises.settled([ // Environment service (paths) Promise.all([ @@ -254,6 +255,8 @@ class CodeMain { // Configuration service configurationService.initialize() ]); + + userDataProfilesMainService.setEnablement(configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); } private async claimInstance(logService: ILogService, environmentMainService: IEnvironmentMainService, lifecycleMainService: ILifecycleMainService, instantiationService: IInstantiationService, productService: IProductService, retry: boolean): Promise { diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 724b3d245b8..6ffc074614c 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -57,7 +57,7 @@ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppen import { buildTelemetryMessage } from 'vs/platform/telemetry/node/telemetry'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService'; -import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; import { UserDataProfilesService } from 'vs/platform/userDataProfile/node/userDataProfile'; class CliMain extends Disposable { @@ -164,6 +164,8 @@ class CliMain extends Disposable { configurationService.initialize() ]); + userDataProfilesService.setEnablement(configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); + // URI Identity services.set(IUriIdentityService, new UriIdentityService(fileService)); diff --git a/src/vs/platform/state/node/state.ts b/src/vs/platform/state/node/state.ts index f3b5e4246c1..a02b3990bf7 100644 --- a/src/vs/platform/state/node/state.ts +++ b/src/vs/platform/state/node/state.ts @@ -11,8 +11,6 @@ export interface IStateService { readonly _serviceBrand: undefined; - readonly whenInitialized: Promise; - getItem(key: string, defaultValue: T): T; getItem(key: string, defaultValue?: T): T | undefined; diff --git a/src/vs/platform/state/node/stateService.ts b/src/vs/platform/state/node/stateService.ts index 5f9c2384d1c..09e49209fb5 100644 --- a/src/vs/platform/state/node/stateService.ts +++ b/src/vs/platform/state/node/stateService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Barrier, ThrottledDelayer } from 'vs/base/common/async'; +import { ThrottledDelayer } from 'vs/base/common/async'; import { VSBuffer } from 'vs/base/common/buffer'; import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; @@ -150,22 +150,16 @@ export class StateService implements IStateService { protected readonly fileStorage: FileStorage; - private readonly initBarrier: Barrier; - readonly whenInitialized: Promise; - constructor( @IEnvironmentService environmentService: IEnvironmentService, @ILogService logService: ILogService, @IFileService fileService: IFileService ) { this.fileStorage = new FileStorage(environmentService.stateResource, logService, fileService); - this.initBarrier = new Barrier(); - this.whenInitialized = this.initBarrier.wait().then(() => undefined); } async init(): Promise { await this.fileStorage.init(); - this.initBarrier.open(); } getItem(key: string, defaultValue: T): T; diff --git a/src/vs/platform/userDataProfile/common/userDataProfile.ts b/src/vs/platform/userDataProfile/common/userDataProfile.ts index 2d4b0776466..8a08c5be01e 100644 --- a/src/vs/platform/userDataProfile/common/userDataProfile.ts +++ b/src/vs/platform/userDataProfile/common/userDataProfile.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { hash } from 'vs/base/common/hash'; +import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry'; import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { joinPath } from 'vs/base/common/resources'; @@ -15,6 +16,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { ILogService } from 'vs/platform/log/common/log'; import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace'; +import { Registry } from 'vs/platform/registry/common/platform'; /** * Flags to indicate whether to use the default profile or not. @@ -61,6 +63,21 @@ export function isUserDataProfile(thing: unknown): thing is IUserDataProfile { ); } +export const PROFILES_ENABLEMENT_CONFIG = 'workbench.experimental.settingsProfiles.enabled'; +export const PROFILES_ENABLEMENT_CONFIG_SCHEMA: IConfigurationPropertySchema = { + 'type': 'boolean', + 'default': false, + 'description': localize('workbench.experimental.settingsProfiles.enabled', "Controls whether to enable the Settings Profiles preview feature."), + scope: ConfigurationScope.APPLICATION +}; + +// Registering here so that the configuration is read properly in main and cli processes. +Registry.as(ConfigurationExtensions.Configuration).registerConfiguration({ + 'properties': { + [PROFILES_ENABLEMENT_CONFIG]: PROFILES_ENABLEMENT_CONFIG_SCHEMA + } +}); + export const IUserDataProfilesService = createDecorator('IUserDataProfilesService'); export interface IUserDataProfilesService { readonly _serviceBrand: undefined; diff --git a/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts b/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts index c798c226ef5..695eef76303 100644 --- a/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts +++ b/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts @@ -11,7 +11,7 @@ import { refineServiceDecorator } from 'vs/platform/instantiation/common/instant import { ILogService } from 'vs/platform/log/common/log'; import { IStateMainService } from 'vs/platform/state/electron-main/state'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; -import { UseDefaultProfileFlags, IUserDataProfile, IUserDataProfilesService, reviveProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { UseDefaultProfileFlags, IUserDataProfile, IUserDataProfilesService, reviveProfile, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace'; import { Promises } from 'vs/base/common/async'; import { UserDataProfilesService } from 'vs/platform/userDataProfile/node/userDataProfile'; @@ -62,6 +62,9 @@ export class UserDataProfilesMainService extends UserDataProfilesService impleme } override async createProfile(profile: IUserDataProfile, workspaceIdentifier?: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): Promise { + if (!this.enabled) { + throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + } profile = reviveProfile(profile, this.profilesHome.scheme); if (this.getStoredProfiles().some(p => p.name === profile.name)) { throw new Error(`Profile with name ${profile.name} already exists`); @@ -90,6 +93,9 @@ export class UserDataProfilesMainService extends UserDataProfilesService impleme } override async setProfileForWorkspace(profile: IUserDataProfile, workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): Promise { + if (!this.enabled) { + throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + } profile = reviveProfile(profile, this.profilesHome.scheme); const workspace = this.getWorkspace(workspaceIdentifier); const storedWorkspaceInfos = this.getStoredWorskpaceInfos().filter(info => !this.uriIdentityService.extUri.isEqual(info.workspace, workspace)); @@ -101,6 +107,9 @@ export class UserDataProfilesMainService extends UserDataProfilesService impleme } override async removeProfile(profile: IUserDataProfile): Promise { + if (!this.enabled) { + throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + } if (profile.isDefault) { throw new Error('Cannot remove default profile'); } diff --git a/src/vs/platform/userDataProfile/node/userDataProfile.ts b/src/vs/platform/userDataProfile/node/userDataProfile.ts index 048d373aac3..1a7f69d3290 100644 --- a/src/vs/platform/userDataProfile/node/userDataProfile.ts +++ b/src/vs/platform/userDataProfile/node/userDataProfile.ts @@ -36,6 +36,8 @@ export class UserDataProfilesService extends BaseUserDataProfilesService impleme protected static readonly PROFILES_KEY = 'userDataProfiles'; protected static readonly WORKSPACE_PROFILE_INFO_KEY = 'workspaceAndProfileInfo'; + protected enabled: boolean = false; + constructor( @IStateService private readonly stateService: IStateService, @IUriIdentityService protected readonly uriIdentityService: IUriIdentityService, @@ -44,11 +46,18 @@ export class UserDataProfilesService extends BaseUserDataProfilesService impleme @ILogService logService: ILogService, ) { super(environmentService, fileService, logService); - stateService.whenInitialized.then(() => this._profilesObject = undefined); + } + + setEnablement(enabled: boolean): void { + this._profilesObject = undefined; + this.enabled = enabled; } protected _profilesObject: UserDataProfilesObject | undefined; protected get profilesObject(): UserDataProfilesObject { + if (!this.enabled) { + return { profiles: [], workspaces: new ResourceMap() }; + } if (!this._profilesObject) { const profiles = this.getStoredProfiles().map(storedProfile => toUserDataProfile(storedProfile.name, storedProfile.location, storedProfile.useDefaultFlags)); const workspaces = new ResourceMap(); diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 60c46a72ffa..148c6c8d379 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -27,6 +27,7 @@ interface IConfiguration extends IWindowsConfiguration { editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' }; security?: { workspace?: { trust?: { enabled?: boolean } } }; window: IWindowSettings & { experimental?: { windowControlsOverlay?: { enabled?: boolean } } }; + workbench?: { experimental?: { settingsProfiles?: { enabled?: boolean } } }; } export class SettingsChangeRelauncher extends Disposable implements IWorkbenchContribution { @@ -39,6 +40,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo private updateMode: string | undefined; private accessibilitySupport: 'on' | 'off' | 'auto' | undefined; private workspaceTrustEnabled: boolean | undefined; + private settingsProfilesEnabled: boolean | undefined; constructor( @IHostService private readonly hostService: IHostService, @@ -94,6 +96,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo changed = true; } + // Profiles + if (typeof config.workbench?.experimental?.settingsProfiles?.enabled === 'boolean' && config.workbench.experimental.settingsProfiles.enabled !== this.settingsProfilesEnabled) { + this.settingsProfilesEnabled = config.workbench.experimental.settingsProfiles.enabled; + changed = true; + } + // On linux turning on accessibility support will also pass this flag to the chrome renderer, thus a restart is required if (isLinux && typeof config.editor?.accessibilitySupport === 'string' && config.editor.accessibilitySupport !== this.accessibilitySupport) { this.accessibilitySupport = config.editor.accessibilitySupport; diff --git a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.ts b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.ts index 5e9683717a0..1f4a953f819 100644 --- a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.ts +++ b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.ts @@ -3,12 +3,22 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; +import { PROFILES_ENABLEMENT_CONFIG, PROFILES_ENABLEMENT_CONFIG_SCHEMA } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration'; import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions'; import { UserDataProfilesWorkbenchContribution } from 'vs/workbench/contrib/userDataProfile/browser/userDataProfile'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import '../common/profileActions'; import '../common/userDataProfileActions'; +Registry.as(ConfigurationExtensions.Configuration).registerConfiguration({ + ...workbenchConfigurationNodeBase, + 'properties': { + [PROFILES_ENABLEMENT_CONFIG]: PROFILES_ENABLEMENT_CONFIG_SCHEMA + } +}); + const workbenchRegistry = Registry.as(Extensions.Workbench); workbenchRegistry.registerWorkbenchContribution(UserDataProfilesWorkbenchContribution, LifecyclePhase.Ready); diff --git a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts index 14f2d211338..5d97df3951c 100644 --- a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts +++ b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts @@ -9,13 +9,12 @@ import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { localize } from 'vs/nls'; import { Action2, ISubmenuItem, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys'; import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { WorkbenchStateContext } from 'vs/workbench/common/contextkeys'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar'; -import { IUserDataProfileManagementService, IUserDataProfileService, ManageProfilesSubMenu, PROFILES_CATEGORY, PROFILES_TTILE } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; +import { IUserDataProfileManagementService, IUserDataProfileService, ManageProfilesSubMenu, PROFILES_CATEGORY, PROFILES_ENABLEMENT_CONTEXT, PROFILES_TTILE } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; const CONTEXT_CURRENT_PROFILE = new RawContextKey('currentUserDataProfile', ''); @@ -52,7 +51,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements private registerManageProfilesSubMenu(): void { const that = this; - const when = ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')); + const when = ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')); MenuRegistry.appendMenuItem(MenuId.GlobalActivity, { get title() { return localize('manageProfiles', "{0} ({1})", PROFILES_TTILE.value, that.userDataProfileService.currentProfile.name); }, submenu: ManageProfilesSubMenu, @@ -87,7 +86,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements const that = this; return registerAction2(class ProfileEntryAction extends Action2 { constructor() { - const when = ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')); + const when = ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')); super({ id: `workbench.profiles.actions.profileEntry.${profile.id}`, title: profile.name, diff --git a/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts b/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts index ef854a2857f..4f9f2ca2328 100644 --- a/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts +++ b/src/vs/workbench/contrib/userDataProfile/common/userDataProfileActions.ts @@ -14,10 +14,9 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation import { INotificationService } from 'vs/platform/notification/common/notification'; import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; import { asJson, asText, IRequestService } from 'vs/platform/request/common/request'; -import { IUserDataProfileTemplate, isUserDataProfileTemplate, IUserDataProfileManagementService, IUserDataProfileWorkbenchService, PROFILES_CATEGORY, PROFILE_EXTENSION, PROFILE_FILTER, ManageProfilesSubMenu, IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; +import { IUserDataProfileTemplate, isUserDataProfileTemplate, IUserDataProfileManagementService, IUserDataProfileWorkbenchService, PROFILES_CATEGORY, PROFILE_EXTENSION, PROFILE_FILTER, ManageProfilesSubMenu, IUserDataProfileService, PROFILES_ENABLEMENT_CONTEXT } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; -import { IsDevelopmentContext } from 'vs/platform/contextkey/common/contextkeys'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { WorkbenchStateContext } from 'vs/workbench/common/contextkeys'; import { CATEGORIES } from 'vs/workbench/common/actions'; @@ -25,7 +24,7 @@ import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' registerAction2(class CreateFromCurrentProfileAction extends Action2 { constructor() { - const when = ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')); + const when = ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')); super({ id: 'workbench.profiles.actions.createFromCurrentProfile', title: { @@ -61,7 +60,7 @@ registerAction2(class CreateFromCurrentProfileAction extends Action2 { registerAction2(class CreateEmptyProfileAction extends Action2 { constructor() { - const when = ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')); + const when = ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')); super({ id: 'workbench.profiles.actions.createProfile', title: { @@ -97,7 +96,7 @@ registerAction2(class CreateEmptyProfileAction extends Action2 { registerAction2(class RemoveProfileAction extends Action2 { constructor() { - const when = ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')); + const when = ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')); super({ id: 'workbench.profiles.actions.removeProfile', title: { @@ -143,7 +142,7 @@ registerAction2(class SwitchProfileAction extends Action2 { }, category: PROFILES_CATEGORY, f1: true, - precondition: ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')), + precondition: ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')), }); } @@ -178,7 +177,7 @@ registerAction2(class CleanupProfilesAction extends Action2 { }, category: CATEGORIES.Developer, f1: true, - precondition: IsDevelopmentContext, + precondition: PROFILES_ENABLEMENT_CONTEXT, }); } @@ -203,7 +202,7 @@ registerAction2(class ExportProfileAction extends Action2 { }, category: PROFILES_CATEGORY, f1: true, - precondition: ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')), + precondition: ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')), }); } @@ -240,7 +239,7 @@ registerAction2(class ImportProfileAction extends Action2 { }, category: PROFILES_CATEGORY, f1: true, - precondition: ContextKeyExpr.and(IsDevelopmentContext, WorkbenchStateContext.notEqualsTo('empty')), + precondition: ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, WorkbenchStateContext.notEqualsTo('empty')), }); } diff --git a/src/vs/workbench/services/userDataProfile/common/userDataProfile.ts b/src/vs/workbench/services/userDataProfile/common/userDataProfile.ts index e08ce615c29..24d3f973e0d 100644 --- a/src/vs/workbench/services/userDataProfile/common/userDataProfile.ts +++ b/src/vs/workbench/services/userDataProfile/common/userDataProfile.ts @@ -8,7 +8,9 @@ import { Event } from 'vs/base/common/event'; import { localize } from 'vs/nls'; import { MenuId } from 'vs/platform/actions/common/actions'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IUserDataProfile, UseDefaultProfileFlags } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { IUserDataProfile, PROFILES_ENABLEMENT_CONFIG, UseDefaultProfileFlags } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { ContextKeyDefinedExpr, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; export interface DidChangeUserDataProfileEvent { readonly preserveData: boolean; @@ -68,8 +70,9 @@ export interface IResourceProfile { applyProfile(content: string): Promise; } -export const ManageProfilesSubMenu = new MenuId('Profiles'); -export const PROFILES_TTILE = { value: localize('settings profiles', "Profiles"), original: 'Profiles' }; +export const ManageProfilesSubMenu = new MenuId('SettingsProfiles'); +export const PROFILES_TTILE = { value: localize('settings profiles', "Settings Profiles"), original: 'Settings Profiles' }; export const PROFILES_CATEGORY = PROFILES_TTILE.value; export const PROFILE_EXTENSION = 'code-profile'; -export const PROFILE_FILTER = [{ name: localize('profile', "Profile"), extensions: [PROFILE_EXTENSION] }]; +export const PROFILE_FILTER = [{ name: localize('profile', "Settings Profile"), extensions: [PROFILE_EXTENSION] }]; +export const PROFILES_ENABLEMENT_CONTEXT = ContextKeyExpr.and(IsWebContext.negate(), ContextKeyDefinedExpr.create(`config.${PROFILES_ENABLEMENT_CONFIG}`));