Skip to content

Commit ab670df

Browse files
authored
disable profiles feature in stable quality (microsoft#153796)
1 parent f4245ce commit ab670df

File tree

8 files changed

+36
-37
lines changed

8 files changed

+36
-37
lines changed

src/vs/code/electron-main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class CodeMain {
256256
configurationService.initialize()
257257
]);
258258

259-
userDataProfilesMainService.setEnablement(configurationService.getValue(PROFILES_ENABLEMENT_CONFIG));
259+
userDataProfilesMainService.setEnablement(!!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG));
260260
}
261261

262262
private async claimInstance(logService: ILogService, environmentMainService: IEnvironmentMainService, lifecycleMainService: ILifecycleMainService, instantiationService: IInstantiationService, productService: IProductService, retry: boolean): Promise<NodeIPCServer> {

src/vs/code/node/cliProcessMain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class CliMain extends Disposable {
164164
configurationService.initialize()
165165
]);
166166

167-
userDataProfilesService.setEnablement(configurationService.getValue(PROFILES_ENABLEMENT_CONFIG));
167+
userDataProfilesService.setEnablement(!!configurationService.getValue(PROFILES_ENABLEMENT_CONFIG));
168168

169169
// URI Identity
170170
services.set(IUriIdentityService, new UriIdentityService(fileService));

src/vs/platform/contextkey/common/contextkeys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const IsMacNativeContext = new RawContextKey<boolean>('isMacNative', isMa
1616
export const IsIOSContext = new RawContextKey<boolean>('isIOS', isIOS, localize('isIOS', "Whether the operating system is iOS"));
1717

1818
export const IsDevelopmentContext = new RawContextKey<boolean>('isDevelopment', false, true);
19+
export const ProductQualityContext = new RawContextKey<string>('productQualityType', '', localize('productQualityType', "Quality type of VS Code"));
1920

2021
export const InputFocusedContextKey = 'inputFocus';
2122
export const InputFocusedContext = new RawContextKey<boolean>(InputFocusedContextKey, false, localize('inputFocus', "Whether keyboard focus is inside an input box"));

src/vs/platform/userDataProfile/common/userDataProfile.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { hash } from 'vs/base/common/hash';
7-
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope, IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry';
87
import { Emitter, Event } from 'vs/base/common/event';
98
import { Disposable } from 'vs/base/common/lifecycle';
109
import { joinPath } from 'vs/base/common/resources';
@@ -16,8 +15,6 @@ import { IFileService } from 'vs/platform/files/common/files';
1615
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
1716
import { ILogService } from 'vs/platform/log/common/log';
1817
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
19-
import { Registry } from 'vs/platform/registry/common/platform';
20-
import { isWeb } from 'vs/base/common/platform';
2118

2219
/**
2320
* Flags to indicate whether to use the default profile or not.
@@ -65,21 +62,6 @@ export function isUserDataProfile(thing: unknown): thing is IUserDataProfile {
6562
}
6663

6764
export const PROFILES_ENABLEMENT_CONFIG = 'workbench.experimental.settingsProfiles.enabled';
68-
export const PROFILES_ENABLEMENT_CONFIG_SCHEMA: IConfigurationPropertySchema = {
69-
'type': 'boolean',
70-
'default': false,
71-
'description': localize('workbench.experimental.settingsProfiles.enabled', "Controls whether to enable the Settings Profiles preview feature."),
72-
scope: ConfigurationScope.APPLICATION
73-
};
74-
75-
if (!isWeb) {
76-
// Registering here so that the configuration is read properly in main and cli processes.
77-
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
78-
'properties': {
79-
[PROFILES_ENABLEMENT_CONFIG]: PROFILES_ENABLEMENT_CONFIG_SCHEMA
80-
}
81-
});
82-
}
8365

8466
export type EmptyWindowWorkspaceIdentifier = 'empty-window';
8567
export type WorkspaceIdentifier = ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier | EmptyWindowWorkspaceIdentifier;

src/vs/workbench/browser/contextkeys.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Event } from 'vs/base/common/event';
77
import { Disposable } from 'vs/base/common/lifecycle';
88
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
9-
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext } from 'vs/platform/contextkey/common/contextkeys';
9+
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext } from 'vs/platform/contextkey/common/contextkeys';
1010
import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext } from 'vs/workbench/common/contextkeys';
1111
import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
1212
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
@@ -24,6 +24,7 @@ import { IEditorResolverService } from 'vs/workbench/services/editor/common/edit
2424
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
2525
import { Schemas } from 'vs/base/common/network';
2626
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
27+
import { IProductService } from 'vs/platform/product/common/productService';
2728

2829
export class WorkbenchContextKeysHandler extends Disposable {
2930
private inputFocusedContext: IContextKey<boolean>;
@@ -76,6 +77,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
7677
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
7778
@IConfigurationService private readonly configurationService: IConfigurationService,
7879
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
80+
@IProductService private readonly productService: IProductService,
7981
@IEditorService private readonly editorService: IEditorService,
8082
@IEditorResolverService private readonly editorResolverService: IEditorResolverService,
8183
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@@ -105,6 +107,9 @@ export class WorkbenchContextKeysHandler extends Disposable {
105107
// Development
106108
IsDevelopmentContext.bindTo(this.contextKeyService).set(!this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment);
107109

110+
// Product Quality
111+
ProductQualityContext.bindTo(this.contextKeyService).set(this.productService.quality || '');
112+
108113
// Editors
109114
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);
110115
this.activeEditorIsReadonly = ActiveEditorReadonlyContext.bindTo(this.contextKeyService);

src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { isWeb } from 'vs/base/common/platform';
7-
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
86
import { Registry } from 'vs/platform/registry/common/platform';
9-
import { PROFILES_ENABLEMENT_CONFIG, PROFILES_ENABLEMENT_CONFIG_SCHEMA } from 'vs/platform/userDataProfile/common/userDataProfile';
10-
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
117
import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
128
import { UserDataProfilesWorkbenchContribution } from 'vs/workbench/contrib/userDataProfile/browser/userDataProfile';
139
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
1410
import '../common/userDataProfileActions';
1511

16-
if (!isWeb) {
17-
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
18-
...workbenchConfigurationNodeBase,
19-
'properties': {
20-
[PROFILES_ENABLEMENT_CONFIG]: PROFILES_ENABLEMENT_CONFIG_SCHEMA
21-
}
22-
});
23-
}
24-
2512
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench);
2613
workbenchRegistry.registerWorkbenchContribution(UserDataProfilesWorkbenchContribution, LifecyclePhase.Ready);

src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66
import { Codicon } from 'vs/base/common/codicons';
77
import { Event } from 'vs/base/common/event';
88
import { Disposable, DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
9+
import { isWeb } from 'vs/base/common/platform';
910
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
1011
import { localize } from 'vs/nls';
1112
import { Action2, ISubmenuItem, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
13+
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
1214
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
15+
import { IProductService } from 'vs/platform/product/common/productService';
16+
import { Registry } from 'vs/platform/registry/common/platform';
1317
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
1418
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
15-
import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
19+
import { IUserDataProfile, IUserDataProfilesService, PROFILES_ENABLEMENT_CONFIG } from 'vs/platform/userDataProfile/common/userDataProfile';
1620
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
21+
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
1722
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
1823
import { IStatusbarEntry, IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
1924
import { IUserDataProfileManagementService, IUserDataProfileService, ManageProfilesSubMenu, PROFILES_CATEGORY, PROFILES_ENABLEMENT_CONTEXT, PROFILES_TTILE } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
@@ -30,10 +35,13 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
3035
@IUserDataProfileManagementService private readonly userDataProfileManagementService: IUserDataProfileManagementService,
3136
@IStatusbarService private readonly statusBarService: IStatusbarService,
3237
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
38+
@IProductService private readonly productService: IProductService,
3339
@IContextKeyService contextKeyService: IContextKeyService,
3440
) {
3541
super();
3642

43+
this.registerConfiguration();
44+
3745
this.currentProfileContext = CONTEXT_CURRENT_PROFILE.bindTo(contextKeyService);
3846
this.currentProfileContext.set(this.userDataProfileService.currentProfile.id);
3947
this._register(this.userDataProfileService.onDidChangeCurrentProfile(e => this.currentProfileContext.set(this.userDataProfileService.currentProfile.id)));
@@ -44,6 +52,22 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
4452
this.registerActions();
4553
}
4654

55+
private registerConfiguration(): void {
56+
if (!isWeb && this.productService.quality !== 'stable') {
57+
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
58+
...workbenchConfigurationNodeBase,
59+
'properties': {
60+
[PROFILES_ENABLEMENT_CONFIG]: {
61+
'type': 'boolean',
62+
'default': false,
63+
'description': localize('workbench.experimental.settingsProfiles.enabled', "Controls whether to enable the Settings Profiles preview feature."),
64+
scope: ConfigurationScope.APPLICATION
65+
}
66+
}
67+
});
68+
}
69+
}
70+
4771
private registerActions(): void {
4872
this.registerManageProfilesSubMenu();
4973

src/vs/workbench/services/userDataProfile/common/userDataProfile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { MenuId } from 'vs/platform/actions/common/actions';
1010
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
1111
import { IUserDataProfile, PROFILES_ENABLEMENT_CONFIG, UseDefaultProfileFlags } from 'vs/platform/userDataProfile/common/userDataProfile';
1212
import { ContextKeyDefinedExpr, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
13-
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
13+
import { IsWebContext, ProductQualityContext } from 'vs/platform/contextkey/common/contextkeys';
1414

1515
export interface DidChangeUserDataProfileEvent {
1616
readonly preserveData: boolean;
@@ -72,4 +72,4 @@ export const PROFILES_TTILE = { value: localize('settings profiles', "Settings P
7272
export const PROFILES_CATEGORY = PROFILES_TTILE.value;
7373
export const PROFILE_EXTENSION = 'code-profile';
7474
export const PROFILE_FILTER = [{ name: localize('profile', "Settings Profile"), extensions: [PROFILE_EXTENSION] }];
75-
export const PROFILES_ENABLEMENT_CONTEXT = ContextKeyExpr.and(IsWebContext.negate(), ContextKeyDefinedExpr.create(`config.${PROFILES_ENABLEMENT_CONFIG}`));
75+
export const PROFILES_ENABLEMENT_CONTEXT = ContextKeyExpr.and(ProductQualityContext.notEqualsTo('stable'), IsWebContext.negate(), ContextKeyDefinedExpr.create(`config.${PROFILES_ENABLEMENT_CONFIG}`));

0 commit comments

Comments
 (0)