diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 7774e605a4861..38baa9e97119a 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -67,7 +67,6 @@ 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'; import { ILoggerMainService, LoggerMainService } from 'vs/platform/log/electron-main/loggerService'; import { LogService } from 'vs/platform/log/common/logService'; @@ -258,7 +257,8 @@ class CodeMain { configurationService.initialize() ]); - userDataProfilesMainService.setEnablement(productService.quality !== 'stable' || configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); + // Initialize user data profiles after initializing the state + userDataProfilesMainService.init(); } 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 7179236d7f6cd..737dadadcaf72 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -58,7 +58,7 @@ import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender'; 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 { IUserDataProfile, IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { UserDataProfilesService } from 'vs/platform/userDataProfile/node/userDataProfile'; import { resolveMachineId } from 'vs/platform/telemetry/node/telemetryUtils'; import { ExtensionsProfileScannerService } from 'vs/platform/extensionManagement/node/extensionsProfileScannerService'; @@ -171,7 +171,8 @@ class CliMain extends Disposable { configurationService.initialize() ]); - userDataProfilesService.setEnablement(productService.quality !== 'stable' || configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); + // Initialize user data profiles after initializing the state + userDataProfilesService.init(); // URI Identity services.set(IUriIdentityService, new UriIdentityService(fileService)); diff --git a/src/vs/platform/userDataProfile/common/userDataProfile.ts b/src/vs/platform/userDataProfile/common/userDataProfile.ts index a8d3c445baa96..4e0d10032cb1b 100644 --- a/src/vs/platform/userDataProfile/common/userDataProfile.ts +++ b/src/vs/platform/userDataProfile/common/userDataProfile.ts @@ -67,8 +67,6 @@ export function isUserDataProfile(thing: unknown): thing is IUserDataProfile { ); } -export const PROFILES_ENABLEMENT_CONFIG = 'workbench.experimental.settingsProfiles.enabled'; - export type DidChangeProfilesEvent = { readonly added: readonly IUserDataProfile[]; readonly removed: readonly IUserDataProfile[]; readonly updated: readonly IUserDataProfile[]; readonly all: readonly IUserDataProfile[] }; export type WillCreateProfileEvent = { @@ -178,7 +176,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf readonly _serviceBrand: undefined; - protected enabled: boolean = false; + protected enabled: boolean = true; readonly profilesHome: URI; get defaultProfile(): IUserDataProfile { return this.profiles[0]; } @@ -214,6 +212,10 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf this.profilesHome = joinPath(this.environmentService.userRoamingDataHome, 'profiles'); } + init(): void { + this._profilesObject = undefined; + } + setEnablement(enabled: boolean): void { if (this.enabled !== enabled) { this._profilesObject = undefined; @@ -288,7 +290,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf async createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: IAnyWorkspaceIdentifier): Promise { if (!this.enabled) { - throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + throw new Error(`Profiles are disabled in the current environment.`); } const profile = await this.doCreateProfile(id, name, options); @@ -338,7 +340,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf async updateProfile(profileToUpdate: IUserDataProfile, options: IUserDataProfileUpdateOptions): Promise { if (!this.enabled) { - throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + throw new Error(`Profiles are disabled in the current environment.`); } let profile = this.profiles.find(p => p.id === profileToUpdate.id); @@ -354,7 +356,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf async removeProfile(profileToRemove: IUserDataProfile): Promise { if (!this.enabled) { - throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + throw new Error(`Profiles are disabled in the current environment.`); } if (profileToRemove.isDefault) { throw new Error('Cannot remove default profile'); @@ -405,7 +407,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf async setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profileToSet: IUserDataProfile): Promise { if (!this.enabled) { - throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + throw new Error(`Profiles are disabled in the current environment.`); } const profile = this.profiles.find(p => p.id === profileToSet.id); @@ -418,7 +420,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf unsetWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, transient?: boolean): void { if (!this.enabled) { - throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`); + throw new Error(`Profiles are disabled in the current environment.`); } this.updateWorkspaceAssociation(workspaceIdentifier, undefined, transient); diff --git a/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts b/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts index 1f286fbd939c5..e55f7355392f0 100644 --- a/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts +++ b/src/vs/platform/userDataProfile/electron-main/userDataProfile.ts @@ -37,15 +37,6 @@ export class UserDataProfilesMainService extends UserDataProfilesService impleme super(stateMainService, uriIdentityService, environmentService, fileService, logService); } - override setEnablement(enabled: boolean): void { - super.setEnablement(enabled); - if (!this.enabled) { - // reset - this.saveStoredProfiles([]); - this.saveStoredProfileAssociations({}); - } - } - getAssociatedEmptyWindows(): IEmptyWorkspaceIdentifier[] { const emptyWindows: IEmptyWorkspaceIdentifier[] = []; for (const id of this.profilesObject.emptyWindows.keys()) { diff --git a/src/vs/platform/userDataProfile/test/common/userDataProfileService.test.ts b/src/vs/platform/userDataProfile/test/common/userDataProfileService.test.ts index e146018fb7c4a..a1ac3c96b738d 100644 --- a/src/vs/platform/userDataProfile/test/common/userDataProfileService.test.ts +++ b/src/vs/platform/userDataProfile/test/common/userDataProfileService.test.ts @@ -40,7 +40,6 @@ suite('UserDataProfileService (Common)', () => { environmentService = new TestEnvironmentService(joinPath(ROOT, 'User')); testObject = new InMemoryUserDataProfilesService(environmentService, fileService, new UriIdentityService(fileService), logService); - testObject.setEnablement(true); }); teardown(() => disposables.clear()); diff --git a/src/vs/platform/userDataProfile/test/electron-main/userDataProfileMainService.test.ts b/src/vs/platform/userDataProfile/test/electron-main/userDataProfileMainService.test.ts index d184f77020d85..831348f3cfded 100644 --- a/src/vs/platform/userDataProfile/test/electron-main/userDataProfileMainService.test.ts +++ b/src/vs/platform/userDataProfile/test/electron-main/userDataProfileMainService.test.ts @@ -45,7 +45,6 @@ suite('UserDataProfileMainService', () => { testObject = new UserDataProfilesMainService(stateService, new UriIdentityService(fileService), environmentService, fileService, logService); await stateService.init(); - testObject.setEnablement(true); }); teardown(() => disposables.clear()); diff --git a/src/vs/platform/userDataSync/test/common/userDataSyncClient.ts b/src/vs/platform/userDataSync/test/common/userDataSyncClient.ts index 34a4d0c07851e..6ad3ce3fcdfb1 100644 --- a/src/vs/platform/userDataSync/test/common/userDataSyncClient.ts +++ b/src/vs/platform/userDataSync/test/common/userDataSyncClient.ts @@ -91,7 +91,6 @@ export class UserDataSyncClient extends Disposable { const userDataProfilesService = new InMemoryUserDataProfilesService(environmentService, fileService, uriIdentityService, logService); this.instantiationService.stub(IUserDataProfilesService, userDataProfilesService); - userDataProfilesService.setEnablement(true); const storageService = new TestStorageService(userDataProfilesService.defaultProfile); this.instantiationService.stub(IStorageService, this._register(storageService)); diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index f9755d91f7f34..eab72b6ed6a8e 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -73,7 +73,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IProgressService } from 'vs/platform/progress/common/progress'; import { DelayedLogChannel } from 'vs/workbench/services/output/common/delayedLogChannel'; import { dirname, joinPath } from 'vs/base/common/resources'; -import { IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { NullPolicyService } from 'vs/platform/policy/common/policy'; import { IRemoteExplorerService, TunnelSource } from 'vs/workbench/services/remote/common/remoteExplorerService'; import { DisposableTunnel, TunnelProtocol } from 'vs/platform/tunnel/common/tunnel'; @@ -82,7 +82,6 @@ import { UserDataProfileService } from 'vs/workbench/services/userDataProfile/co import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { BrowserUserDataProfilesService } from 'vs/platform/userDataProfile/browser/userDataProfile'; import { timeout } from 'vs/base/common/async'; -import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { rendererLogId } from 'vs/workbench/common/logConstants'; import { LogService } from 'vs/platform/log/common/logService'; @@ -293,19 +292,9 @@ export class BrowserMain extends Disposable { // User Data Profiles const userDataProfilesService = new BrowserUserDataProfilesService(environmentService, fileService, uriIdentityService, logService); serviceCollection.set(IUserDataProfilesService, userDataProfilesService); - let isProfilesEnablementConfigured = false; if (environmentService.remoteAuthority) { // Always Disabled in web with remote connection userDataProfilesService.setEnablement(false); - } else { - if (productService.quality === 'stable') { - // Enabled from Config - userDataProfilesService.setEnablement(window.localStorage.getItem(PROFILES_ENABLEMENT_CONFIG) === 'true'); - isProfilesEnablementConfigured = true; - } else { - // Always Enabled - userDataProfilesService.setEnablement(true); - } } const currentProfile = userDataProfilesService.getProfileForWorkspace(workspace) ?? userDataProfilesService.defaultProfile; @@ -334,15 +323,6 @@ export class BrowserMain extends Disposable { }) ]); - if (isProfilesEnablementConfigured) { - userDataProfilesService.setEnablement(!!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); - this._register(configurationService.onDidChangeConfiguration(e => { - if (e.source !== ConfigurationTarget.DEFAULT && e.affectsConfiguration(PROFILES_ENABLEMENT_CONFIG)) { - window.localStorage.setItem(PROFILES_ENABLEMENT_CONFIG, !!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG) ? 'true' : 'false'); - } - })); - } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // // NOTE: Please do NOT register services here. Use `registerSingleton()` diff --git a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts index 768ca253bc042..1610507311bd5 100644 --- a/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts +++ b/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts @@ -27,7 +27,7 @@ interface IConfiguration extends IWindowsConfiguration { editor?: { accessibilitySupport?: 'on' | 'off' | 'auto' }; security?: { workspace?: { trust?: { enabled?: boolean } } }; window: IWindowSettings & { experimental?: { windowControlsOverlay?: { enabled?: boolean }; useSandbox?: boolean } }; - workbench?: { experimental?: { settingsProfiles?: { enabled?: boolean } }; enableExperiments?: boolean }; + workbench?: { enableExperiments?: boolean }; extensions?: { experimental?: { useUtilityProcess?: boolean } }; _extensionsGallery?: { enablePPE?: boolean }; } @@ -45,7 +45,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo 'update.mode', 'editor.accessibilitySupport', 'security.workspace.trust.enabled', - 'workbench.experimental.settingsProfiles.enabled', 'workbench.enableExperiments', '_extensionsGallery.enablePPE' ]; @@ -60,7 +59,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo private readonly updateMode = new ChangeObserver('string'); private accessibilitySupport: 'on' | 'off' | 'auto' | undefined; private readonly workspaceTrustEnabled = new ChangeObserver('boolean'); - private readonly profilesEnabled = new ChangeObserver('boolean'); private readonly experimentsEnabled = new ChangeObserver('boolean'); private readonly enablePPEExtensionsGallery = new ChangeObserver('boolean'); @@ -127,9 +125,6 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo processChanged(this.workspaceTrustEnabled.handleChange(config?.security?.workspace?.trust?.enabled)); } - // Profiles - processChanged(this.productService.quality === 'stable' && this.profilesEnabled.handleChange(config.workbench?.experimental?.settingsProfiles?.enabled)); - // Experiments processChanged(this.experimentsEnabled.handleChange(config.workbench?.enableExperiments)); diff --git a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts index 7cf01221963cc..4b3866d5a355d 100644 --- a/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts +++ b/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts @@ -10,22 +10,15 @@ 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 { ICommandService } from 'vs/platform/commands/common/commands'; -import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IProductService } from 'vs/platform/product/common/productService'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { IUserDataProfile, IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile'; -import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration'; +import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { RenameProfileAction } from 'vs/workbench/contrib/userDataProfile/browser/userDataProfileActions'; import { ILifecycleService, LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; -import { CURRENT_PROFILE_CONTEXT, HAS_PROFILES_CONTEXT, isUserDataProfileTemplate, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT, IUserDataProfileImportExportService, IUserDataProfileManagementService, IUserDataProfileService, IUserDataProfileTemplate, PROFILES_CATEGORY, PROFILES_ENABLEMENT_CONTEXT, PROFILE_FILTER, IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT, ProfilesMenu } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; +import { CURRENT_PROFILE_CONTEXT, HAS_PROFILES_CONTEXT, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT, IUserDataProfileImportExportService, IUserDataProfileManagementService, IUserDataProfileService, PROFILES_CATEGORY, PROFILE_FILTER, IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT, ProfilesMenu, PROFILES_ENABLEMENT_CONTEXT } from 'vs/workbench/services/userDataProfile/common/userDataProfile'; import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IDialogService, IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; -import { IFileService } from 'vs/platform/files/common/files'; -import { asJson, asText, IRequestService } from 'vs/platform/request/common/request'; -import { CancellationToken } from 'vs/base/common/cancellation'; +import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; import { URI } from 'vs/base/common/uri'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -54,7 +47,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements @IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService, @IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService, @IUserDataProfileManagementService private readonly userDataProfileManagementService: IUserDataProfileManagementService, - @IProductService private readonly productService: IProductService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IWorkspaceTagsService private readonly workspaceTagsService: IWorkspaceTagsService, @@ -65,8 +57,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements ) { super(); - this.registerConfiguration(); - this.currentProfileContext = CURRENT_PROFILE_CONTEXT.bindTo(contextKeyService); PROFILES_ENABLEMENT_CONTEXT.bindTo(contextKeyService).set(this.userDataProfilesService.isEnabled()); this.isCurrentProfileTransientContext = IS_CURRENT_PROFILE_TRANSIENT_CONTEXT.bindTo(contextKeyService); @@ -91,23 +81,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements this.reportWorkspaceProfileInfo(); } - private registerConfiguration(): void { - if (this.productService.quality === 'stable') { - Registry.as(ConfigurationExtensions.Configuration).registerConfiguration({ - ...workbenchConfigurationNodeBase, - 'properties': { - [PROFILES_ENABLEMENT_CONFIG]: { - 'type': 'boolean', - 'default': false, - 'description': localize('workbench.experimental.profiles.enabled', "Controls whether to enable the Profiles preview feature."), - scope: ConfigurationScope.APPLICATION, - ignoreSync: true - } - } - }); - } - } - private registerActions(): void { this.registerProfileSubMenu(); @@ -138,7 +111,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements submenu: ProfilesMenu, group: '1_profiles', order: 1, - when: PROFILES_ENABLEMENT_CONTEXT, }); MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, { get title() { @@ -234,7 +206,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements { id: ProfilesMenu, group: '2_manage_current', - when: PROFILES_ENABLEMENT_CONTEXT, order: 3 }, { id: MenuId.CommandPalette @@ -268,7 +239,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements { id: ProfilesMenu, group: '4_import_export_profiles', - when: PROFILES_ENABLEMENT_CONTEXT, order: 1 }, { id: MenuId.CommandPalette @@ -307,7 +277,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements original: 'Import Profile...' }, category: PROFILES_CATEGORY, - f1: true, precondition: IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT.toNegated(), menu: [ { @@ -315,6 +284,9 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements group: '4_import_export_profiles', when: PROFILES_ENABLEMENT_CONTEXT, order: 2 + }, { + id: MenuId.CommandPalette, + when: PROFILES_ENABLEMENT_CONTEXT, } ] }); @@ -323,24 +295,9 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements async run(accessor: ServicesAccessor) { const fileDialogService = accessor.get(IFileDialogService); const quickInputService = accessor.get(IQuickInputService); - const fileService = accessor.get(IFileService); - const requestService = accessor.get(IRequestService); const userDataProfileImportExportService = accessor.get(IUserDataProfileImportExportService); - const dialogService = accessor.get(IDialogService); - const contextKeyService = accessor.get(IContextKeyService); const notificationService = accessor.get(INotificationService); - const isSettingProfilesEnabled = contextKeyService.contextMatchesRules(PROFILES_ENABLEMENT_CONTEXT); - - if (!isSettingProfilesEnabled) { - if (!(await dialogService.confirm({ - title: localize('import profile title', "Import Settings from a Profile"), - message: localize('confiirmation message', "This will replace your current settings. Are you sure you want to continue?"), - })).confirmed) { - return; - } - } - const disposables = new DisposableStore(); const quickPick = disposables.add(quickInputService.createQuickPick()); const updateQuickPickItems = (value?: string) => { @@ -357,16 +314,9 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements disposables.add(quickPick.onDidAccept(async () => { try { quickPick.hide(); - if (isSettingProfilesEnabled) { - const profile = quickPick.selectedItems[0].description ? URI.parse(quickPick.value) : await this.getProfileUriFromFileSystem(fileDialogService); - if (profile) { - await userDataProfileImportExportService.importProfile(profile); - } - } else { - const profile = quickPick.selectedItems[0].description ? await this.getProfileFromURL(quickPick.value, requestService) : await this.getProfileFromFileSystem(fileDialogService, fileService); - if (profile) { - await userDataProfileImportExportService.setProfile(profile); - } + const profile = quickPick.selectedItems[0].description ? URI.parse(quickPick.value) : await this.getProfileUriFromFileSystem(fileDialogService); + if (profile) { + await userDataProfileImportExportService.importProfile(profile); } } catch (error) { notificationService.error(localize('profile import error', "Error while importing profile: {0}", getErrorMessage(error))); @@ -389,28 +339,6 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements } return profileLocation[0]; } - - private async getProfileFromFileSystem(fileDialogService: IFileDialogService, fileService: IFileService): Promise { - const profileLocation = await this.getProfileUriFromFileSystem(fileDialogService); - if (!profileLocation) { - return null; - } - const content = (await fileService.readFile(profileLocation)).value.toString(); - const parsed = JSON.parse(content); - return isUserDataProfileTemplate(parsed) ? parsed : null; - } - - private async getProfileFromURL(url: string, requestService: IRequestService): Promise { - const options = { type: 'GET', url }; - const context = await requestService.request(options, CancellationToken.None); - if (context.res.statusCode === 200) { - const result = await asJson(context); - return isUserDataProfileTemplate(result) ? result : null; - } else { - const message = await asText(context); - throw new Error(`Expected 200, got back ${context.res.statusCode} instead.\n\n${message}`); - } - } })); disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarShare, { command: { diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index 7edfe9b27dfb1..98b0a163e298a 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -48,7 +48,7 @@ import { isCI, isMacintosh } from 'vs/base/common/platform'; import { Schemas } from 'vs/base/common/network'; import { DiskFileSystemProvider } from 'vs/workbench/services/files/electron-sandbox/diskFileSystemProvider'; import { FileUserDataProvider } from 'vs/platform/userData/common/fileUserDataProvider'; -import { IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG, reviveProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; +import { IUserDataProfilesService, reviveProfile } from 'vs/platform/userDataProfile/common/userDataProfile'; import { UserDataProfilesNativeService } from 'vs/platform/userDataProfile/electron-sandbox/userDataProfile'; import { PolicyChannelClient } from 'vs/platform/policy/common/policyIpc'; import { IPolicyService, NullPolicyService } from 'vs/platform/policy/common/policy'; @@ -285,8 +285,6 @@ export class DesktopMain extends Disposable { }) ]); - userDataProfilesService.setEnablement(productService.quality !== 'stable' || configurationService.getValue(PROFILES_ENABLEMENT_CONFIG)); - // Workspace Trust Service const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService); serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService);