rename to Profile (#166030)

This commit is contained in:
Sandeep Somavarapu
2022-11-10 19:25:07 +01:00
committed by GitHub
parent 436a45ed1c
commit d2441c5e3a
21 changed files with 110 additions and 112 deletions

View File

@@ -409,7 +409,7 @@
// "activityBar.foreground": "",
// "activityBarBadge.background": "",
// "activityBarBadge.foreground": "",
"activityBarItem.settingsProfilesBackground": "#082877",
"activityBarItem.profilesBackground": "#082877",
// Workbench: Panel
// "panel.background": "",

View File

@@ -2,7 +2,7 @@
"$schema": "vscode://schemas/color-theme",
"name": "Light (Visual Studio)",
"colors": {
"activityBarItem.settingsProfilesBackground": "#4d4d4d",
"activityBarItem.profilesBackground": "#4d4d4d",
"editor.background": "#FFFFFF",
"editor.foreground": "#000000",
"editor.inactiveSelectionBackground": "#E5EBF1",

View File

@@ -32,7 +32,7 @@
"ports.iconRunningProcessForeground": "#369432",
"activityBar.background": "#221a0f",
"activityBar.foreground": "#d3af86",
"activityBarItem.settingsProfilesBackground": "#47351d",
"activityBarItem.profilesBackground": "#47351d",
"sideBar.background": "#362712",
"menu.background": "#362712",
"menu.foreground": "#CCCCCC",

View File

@@ -36,7 +36,7 @@
"statusBar.noFolderBackground": "#001126",
"statusBar.debuggingBackground": "#001126",
"activityBar.background": "#001733",
"activityBarItem.settingsProfilesBackground": "#003271",
"activityBarItem.profilesBackground": "#003271",
"progressBar.background": "#bbdaffcc",
"badge.background": "#bbdaffcc",
"badge.foreground": "#001733",

View File

@@ -77,7 +77,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'waitMarkerFilePath': { type: 'string' },
'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") },
'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
'profile': { type: 'string', 'cat': 'o', args: 'settingsProfileName', description: localize('settingsProfileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created. A folder or workspace must be provided for the profile to take effect.") },
'profile': { type: 'string', 'cat': 'o', args: 'profileName', description: localize('profileName', "Opens the provided folder or workspace with the given profile and associates the profile with the workspace. If the profile does not exist, a new empty one is created. A folder or workspace must be provided for the profile to take effect.") },
'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },
'extensions-dir': { type: 'string', deprecates: ['extensionHomePath'], cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },

View File

@@ -275,7 +275,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
async createProfile(id: string, name: string, options?: IUserDataProfileOptions, workspaceIdentifier?: WorkspaceIdentifier): Promise<IUserDataProfile> {
if (!this.enabled) {
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
}
const profile = await this.doCreateProfile(id, name, options);
@@ -322,7 +322,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
async updateProfile(profileToUpdate: IUserDataProfile, options: IUserDataProfileUpdateOptions): Promise<IUserDataProfile> {
if (!this.enabled) {
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
}
let profile = this.profiles.find(p => p.id === profileToUpdate.id);
@@ -338,7 +338,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
async removeProfile(profileToRemove: IUserDataProfile): Promise<void> {
if (!this.enabled) {
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
}
if (profileToRemove.isDefault) {
throw new Error('Cannot remove default profile');
@@ -408,7 +408,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
setProfileForWorkspaceSync(workspaceIdentifier: WorkspaceIdentifier, profileToSet: IUserDataProfile): void {
if (!this.enabled) {
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
}
const profile = this.profiles.find(p => p.id === profileToSet.id);
@@ -421,7 +421,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
unsetWorkspace(workspaceIdentifier: WorkspaceIdentifier, transient?: boolean): void {
if (!this.enabled) {
throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
throw new Error(`Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
}
this.updateWorkspaceAssociation(workspaceIdentifier, undefined, transient);

View File

@@ -218,7 +218,7 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
}
const profile = this.userDataProfilesService.profiles.find(p => p.id === syncProfile.id);
if (!profile) {
this.logService.error(`Settings Profile with id:${syncProfile.id} and name: ${syncProfile.name} does not exist locally to sync.`);
this.logService.error(`Profile with id:${syncProfile.id} and name: ${syncProfile.name} does not exist locally to sync.`);
continue;
}
this.logService.info('Syncing profile.', syncProfile.name);

View File

@@ -19,7 +19,7 @@ import { IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platf
import { ActivityAction, ActivityActionViewItem, IActivityActionViewItemOptions, IActivityHoverOptions, ICompositeBar, ICompositeBarColors, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions';
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
import { IActivity } from 'vs/workbench/common/activity';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_SETTINGS_PROFILE_BACKGROUND, ACTIVITY_BAR_SETTINGS_PROFILE_HOVER_FOREGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_PROFILE_BACKGROUND, ACTIVITY_BAR_PROFILE_HOVER_FOREGROUND } from 'vs/workbench/common/theme';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
@@ -381,7 +381,7 @@ export class ProfilesActivityActionViewItem extends MenuActivityActionViewItem {
}
protected override computeTitle(): string {
return localize('profiles', "{0} (Settings Profile)", this.userDataProfileService.currentProfile.name);
return localize('profiles', "{0} (Profile)", this.userDataProfileService.currentProfile.name);
}
}
@@ -510,24 +510,24 @@ registerThemingParticipant((theme, collector) => {
`);
}
const activityBarSettingsProfileBgColor = theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_BACKGROUND);
if (activityBarSettingsProfileBgColor) {
const activityBarProfileBgColor = theme.getColor(ACTIVITY_BAR_PROFILE_BACKGROUND);
if (activityBarProfileBgColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label.profile-activity-item {
background-color: ${activityBarSettingsProfileBgColor} !important;
background-color: ${activityBarProfileBgColor} !important;
}
`);
}
const activityBarSettingsProfileHoverFgColor = theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_HOVER_FOREGROUND);
if (activityBarSettingsProfileHoverFgColor) {
const activityBarProfileHoverFgColor = theme.getColor(ACTIVITY_BAR_PROFILE_HOVER_FOREGROUND);
if (activityBarProfileHoverFgColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label.profile-activity-item,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .action-label.profile-activity-item,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label.profile-activity-item {
color: ${activityBarSettingsProfileHoverFgColor} !important;
color: ${activityBarProfileHoverFgColor} !important;
}
`);
}

View File

@@ -16,7 +16,7 @@ import { IDisposable, toDisposable, DisposableStore, Disposable } from 'vs/base/
import { Event } from 'vs/base/common/event';
import { ToggleActivityBarVisibilityAction, ToggleSidebarPositionAction } from 'vs/workbench/browser/actions/layoutActions';
import { IThemeService, IColorTheme, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BORDER, ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BORDER, ACTIVITY_BAR_PROFILE_FOREGROUND } from 'vs/workbench/common/theme';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from 'vs/workbench/browser/parts/compositeBar';
import { Dimension, createCSSRule, asCSSUrl, addDisposableListener, EventType, isAncestor } from 'vs/base/browser/dom';
@@ -535,7 +535,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
}
if (action.id === 'workbench.actions.profiles') {
return this.instantiationService.createInstance(ProfilesActivityActionViewItem, action as ActivityAction, () => this.compositeBar.getContextMenuActions(), (theme: IColorTheme) => this.getSettingsProfileItemColors(theme), this.getActivityHoverOptions());
return this.instantiationService.createInstance(ProfilesActivityActionViewItem, action as ActivityAction, () => this.compositeBar.getContextMenuActions(), (theme: IColorTheme) => this.getProfileItemColors(theme), this.getActivityHoverOptions());
}
throw new Error(`No view item for action '${action.id}'`);
@@ -847,11 +847,11 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
};
}
private getSettingsProfileItemColors(theme: IColorTheme): ICompositeBarColors {
private getProfileItemColors(theme: IColorTheme): ICompositeBarColors {
return {
...this.getActivitybarItemColors(theme),
activeForegroundColor: theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND),
inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND),
activeForegroundColor: theme.getColor(ACTIVITY_BAR_PROFILE_FOREGROUND),
inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_PROFILE_FOREGROUND),
};
}

View File

@@ -625,26 +625,26 @@ export const ACTIVITY_BAR_BADGE_FOREGROUND = registerColor('activityBarBadge.for
hcLight: Color.white
}, localize('activityBarBadgeForeground', "Activity notification badge foreground color. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
export const ACTIVITY_BAR_SETTINGS_PROFILE_FOREGROUND = registerColor('activityBarItem.settingsProfilesForeground', {
export const ACTIVITY_BAR_PROFILE_FOREGROUND = registerColor('activityBarItem.profilesForeground', {
dark: ACTIVITY_BAR_INACTIVE_FOREGROUND,
light: ACTIVITY_BAR_INACTIVE_FOREGROUND,
hcDark: ACTIVITY_BAR_INACTIVE_FOREGROUND,
hcLight: ACTIVITY_BAR_INACTIVE_FOREGROUND
}, localize('statusBarItemSettingsProfileForeground', "Foreground color for the settings profile entry on the activity bar."));
}, localize('activityBarItem.profilesForeground', "Foreground color for the profile entry on the activity bar."));
export const ACTIVITY_BAR_SETTINGS_PROFILE_HOVER_FOREGROUND = registerColor('activityBarItem.settingsProfilesHoverForeground', {
export const ACTIVITY_BAR_PROFILE_HOVER_FOREGROUND = registerColor('activityBarItem.profilesHoverForeground', {
dark: ACTIVITY_BAR_FOREGROUND,
light: ACTIVITY_BAR_FOREGROUND,
hcDark: ACTIVITY_BAR_FOREGROUND,
hcLight: ACTIVITY_BAR_FOREGROUND
}, localize('activityBarItem.settingsProfilesHoverForeground', "Foreground color for the settings profile entry on the activity bar when hovering."));
}, localize('activityBarItem.profilesHoverForeground', "Foreground color for the profile entry on the activity bar when hovering."));
export const ACTIVITY_BAR_SETTINGS_PROFILE_BACKGROUND = registerColor('activityBarItem.settingsProfilesBackground', {
export const ACTIVITY_BAR_PROFILE_BACKGROUND = registerColor('activityBarItem.profilesBackground', {
dark: lighten(ACTIVITY_BAR_BACKGROUND, 0.5),
light: darken(ACTIVITY_BAR_BACKGROUND, 0.12),
hcDark: null,
hcLight: null
}, localize('statusBarItemSettingsProfileBackground', "Background color for the settings profile entry on the activity bar."));
}, localize('activityBarItem.profilesBackground', "Background color for the profile entry on the activity bar."));
// < --- Remote --- >

View File

@@ -42,7 +42,7 @@ 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 settingsProfilesEnabled = new ChangeObserver('boolean');
private readonly profilesEnabled = new ChangeObserver('boolean');
private readonly experimentsEnabled = new ChangeObserver('boolean');
private readonly enablePPEExtensionsGallery = new ChangeObserver('boolean');
@@ -101,7 +101,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
}
// Profiles
processChanged(this.productService.quality === 'stable' && this.settingsProfilesEnabled.handleChange(config.workbench?.experimental?.settingsProfiles?.enabled));
processChanged(this.productService.quality === 'stable' && this.profilesEnabled.handleChange(config.workbench?.experimental?.settingsProfiles?.enabled));
// Experiments
processChanged(this.experimentsEnabled.handleChange(config.workbench?.enableExperiments));

View File

@@ -80,7 +80,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
[PROFILES_ENABLEMENT_CONFIG]: {
'type': 'boolean',
'default': false,
'description': localize('workbench.experimental.settingsProfiles.enabled', "Controls whether to enable the Settings Profiles preview feature."),
'description': localize('workbench.experimental.profiles.enabled', "Controls whether to enable the Profiles preview feature."),
scope: ConfigurationScope.APPLICATION,
ignoreSync: true
}
@@ -301,8 +301,8 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
command: {
id,
title: {
value: localize('export settings profile', "Export Settings Profile ({0})...", that.userDataProfileService.currentProfile.name),
original: `Export Settings Profile (${that.userDataProfileService.currentProfile.name})...`
value: localize('export profile in share', "Export Profile ({0})...", that.userDataProfileService.currentProfile.name),
original: `Export Profile (${that.userDataProfileService.currentProfile.name})...`
},
precondition: PROFILES_ENABLEMENT_CONTEXT,
},
@@ -358,10 +358,10 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
const disposables = new DisposableStore();
const quickPick = disposables.add(quickInputService.createQuickPick());
const updateQuickPickItems = (value?: string) => {
const selectFromFileItem: IQuickPickItem = { label: isSettingProfilesEnabled ? localize('select from file', "Select Settings Profile template file") : localize('import from file', "Import from profile file") };
const selectFromFileItem: IQuickPickItem = { label: isSettingProfilesEnabled ? localize('select from file', "Select Profile template file") : localize('import from file', "Import from profile file") };
quickPick.items = value ? [{ label: isSettingProfilesEnabled ? localize('select from url', "Create from template URL") : localize('import from url', "Import from URL"), description: quickPick.value }, selectFromFileItem] : [selectFromFileItem];
};
quickPick.title = isSettingProfilesEnabled ? localize('create from profile template quick pick title', "Create from Settings Profile Template") : localize('import profile quick pick title', "Import Settings from a Profile");
quickPick.title = isSettingProfilesEnabled ? localize('create from profile template quick pick title', "Create from Profile Template") : localize('import profile quick pick title', "Import Settings from a Profile");
quickPick.placeholder = isSettingProfilesEnabled ? localize('create from profile template placeholder', "Provide a template URL or Select a template file") : localize('import profile placeholder', "Provide profile URL or select profile file to import");
quickPick.ignoreFocusOut = true;
disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
@@ -419,8 +419,8 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
command: {
id,
title: {
value: localize('import settings profile', "Import Settings Profile...",),
original: 'Import Settings Profile...'
value: localize('import profile share', "Import Profile...",),
original: 'Import Profile...'
},
precondition: PROFILES_ENABLEMENT_CONTEXT,
},

View File

@@ -21,7 +21,7 @@ import { IAction, Separator } from 'vs/base/common/actions';
class CreateFromCurrentProfileAction extends Action2 {
static readonly ID = 'workbench.profiles.actions.createFromCurrentProfile';
static readonly TITLE = {
value: localize('save profile as', "Create from Current Settings Profile..."),
value: localize('save profile as', "Create from Current Profile..."),
original: 'Create from Current Profile...'
};
constructor() {
@@ -41,10 +41,10 @@ class CreateFromCurrentProfileAction extends Action2 {
const userDataProfilesService = accessor.get(IUserDataProfilesService);
const name = await quickInputService.input({
placeHolder: localize('name', "Profile name"),
title: localize('save profile as', "Create from Current Settings Profile..."),
title: localize('save profile as', "Create from Current Profile..."),
validateInput: async (value: string) => {
if (userDataProfilesService.profiles.some(p => p.name === value)) {
return localize('profileExists', "Settings Profile with name {0} already exists.", value);
return localize('profileExists', "Profile with name {0} already exists.", value);
}
return undefined;
}
@@ -63,8 +63,8 @@ registerAction2(CreateFromCurrentProfileAction);
class CreateEmptyProfileAction extends Action2 {
static readonly ID = 'workbench.profiles.actions.createEmptyProfile';
static readonly TITLE = {
value: localize('create empty profile', "Create an Empty Settings Profile..."),
original: 'Create an Empty Settings Profile...'
value: localize('create empty profile', "Create an Empty Profile..."),
original: 'Create an Empty Profile...'
};
constructor() {
super({
@@ -86,7 +86,7 @@ class CreateEmptyProfileAction extends Action2 {
title: localize('create and enter empty profile', "Create an Empty Profile..."),
validateInput: async (value: string) => {
if (userDataProfilesService.profiles.some(p => p.name === value)) {
return localize('profileExists', "Settings Profile with name {0} already exists.", value);
return localize('profileExists', "Profile with name {0} already exists.", value);
}
return undefined;
}
@@ -141,7 +141,7 @@ registerAction2(class CreateProfileAction extends Action2 {
}, {
id: CreateTransientProfileAction.ID,
label: CreateTransientProfileAction.TITLE.value,
}], { hideInput: true, canPickMany: false, title: localize('create settings profile', "{0}: Create...", PROFILES_CATEGORY.value) });
}], { hideInput: true, canPickMany: false, title: localize('create profile title', "{0}: Create...", PROFILES_CATEGORY.value) });
if (pick?.id) {
return commandService.executeCommand(pick.id);
}
@@ -151,8 +151,8 @@ registerAction2(class CreateProfileAction extends Action2 {
class CreateTransientProfileAction extends Action2 {
static readonly ID = 'workbench.profiles.actions.createTemporaryProfile';
static readonly TITLE = {
value: localize('create temporary profile', "Create a Temporary Settings Profile"),
original: 'Create a Temporary Settings Profile'
value: localize('create temporary profile', "Create a Temporary Profile"),
original: 'Create a Temporary Profile'
};
constructor() {
super({
@@ -211,10 +211,10 @@ export class RenameProfileAction extends Action2 {
const name = await quickInputService.input({
value: profile.name,
title: localize('select settings profile to rename', 'Rename {0}', profile.name),
title: localize('select profile to rename', 'Rename {0}', profile.name),
validateInput: async (value: string) => {
if (profile!.name !== value && userDataProfilesService.profiles.some(p => p.name === value)) {
return localize('profileExists', "Settings Profile with name {0} already exists.", value);
return localize('profileExists', "Profile with name {0} already exists.", value);
}
return undefined;
}
@@ -240,8 +240,8 @@ export class RenameProfileAction extends Action2 {
profile
})),
{
title: localize('rename specific settings profile', "Rename Settings Profile..."),
placeHolder: localize('pick profile to rename', "Select Settings Profile to Rename"),
title: localize('rename specific profile', "Rename Profile..."),
placeHolder: localize('pick profile to rename', "Select Profile to Rename"),
});
return pick?.profile;
}
@@ -287,8 +287,8 @@ registerAction2(class DeleteProfileAction extends Action2 {
profile
})),
{
title: localize('delete specific settings profile', "Delete Settings Profile..."),
placeHolder: localize('pick profile to delete', "Select Settings Profiles to Delete"),
title: localize('delete specific profile', "Delete Profile..."),
placeHolder: localize('pick profile to delete', "Select Profiles to Delete"),
canPickMany: true
});
if (picks) {
@@ -302,7 +302,7 @@ registerAction2(class DeleteProfileAction extends Action2 {
}
});
registerAction2(class ManageSettingsProfileAction extends Action2 {
registerAction2(class ManageProfilesAction extends Action2 {
constructor() {
super({
id: MANAGE_PROFILES_ACTION_ID,
@@ -370,7 +370,7 @@ registerAction2(class SwitchProfileAction extends Action2 {
label: `${profile.name}${profile.id === userDataProfileService.currentProfile.id ? ` $(${Codicon.check.id})` : ''}`,
profile
}));
const pick = await quickInputService.pick(picks, { placeHolder: localize('pick profile', "Select Settings Profile") });
const pick = await quickInputService.pick(picks, { placeHolder: localize('pick profile', "Select Profile") });
if (pick) {
await userDataProfileManagementService.switchProfile(pick.profile);
}
@@ -385,7 +385,7 @@ registerAction2(class CleanupProfilesAction extends Action2 {
super({
id: 'workbench.profiles.actions.cleanupProfiles',
title: {
value: localize('cleanup profile', "Cleanup Settings Profiles"),
value: localize('cleanup profile', "Cleanup Profiles"),
original: 'Cleanup Profiles'
},
category: Categories.Developer,
@@ -404,8 +404,8 @@ registerAction2(class ResetWorkspacesAction extends Action2 {
super({
id: 'workbench.profiles.actions.resetWorkspaces',
title: {
value: localize('reset workspaces', "Reset Workspace Settings Profiles Associations"),
original: 'Reset Workspace Settings Profiles Associations'
value: localize('reset workspaces', "Reset Workspace Profiles Associations"),
original: 'Reset Workspace Profiles Associations'
},
category: Categories.Developer,
f1: true,

View File

@@ -34,14 +34,14 @@ export class UserDataProfileManagementService extends Disposable implements IUse
private onDidChangeProfiles(e: DidChangeProfilesEvent): void {
if (e.removed.some(profile => profile.id === this.userDataProfileService.currentProfile.id)) {
this.enterProfile(this.userDataProfilesService.defaultProfile, false, localize('reload message when removed', "The current settings profile has been removed. Please reload to switch back to default settings profile"));
this.enterProfile(this.userDataProfilesService.defaultProfile, false, localize('reload message when removed', "The current profile has been removed. Please reload to switch back to default profile"));
return;
}
}
private onDidResetWorkspaces(): void {
if (!this.userDataProfileService.currentProfile.isDefault) {
this.enterProfile(this.userDataProfilesService.defaultProfile, false, localize('reload message when removed', "The current settings profile has been removed. Please reload to switch back to default settings profile"));
this.enterProfile(this.userDataProfilesService.defaultProfile, false, localize('reload message when removed', "The current profile has been removed. Please reload to switch back to default profile"));
return;
}
}
@@ -66,20 +66,20 @@ export class UserDataProfileManagementService extends Disposable implements IUse
async updateProfile(profile: IUserDataProfile, updateOptions: IUserDataProfileUpdateOptions): Promise<void> {
if (!this.userDataProfilesService.profiles.some(p => p.id === profile.id)) {
throw new Error(`Settings profile ${profile.name} does not exist`);
throw new Error(`Profile ${profile.name} does not exist`);
}
if (profile.isDefault) {
throw new Error(localize('cannotRenameDefaultProfile', "Cannot rename the default settings profile"));
throw new Error(localize('cannotRenameDefaultProfile', "Cannot rename the default profile"));
}
await this.userDataProfilesService.updateProfile(profile, updateOptions);
}
async removeProfile(profile: IUserDataProfile): Promise<void> {
if (!this.userDataProfilesService.profiles.some(p => p.id === profile.id)) {
throw new Error(`Settings profile ${profile.name} does not exist`);
throw new Error(`Profile ${profile.name} does not exist`);
}
if (profile.isDefault) {
throw new Error(localize('cannotDeleteDefaultProfile', "Cannot delete the default settings profile"));
throw new Error(localize('cannotDeleteDefaultProfile', "Cannot delete the default profile"));
}
await this.userDataProfilesService.removeProfile(profile);
}
@@ -120,7 +120,7 @@ export class UserDataProfileManagementService extends Disposable implements IUse
if (isRemoteWindow) {
const result = await this.dialogService.confirm({
type: 'info',
message: reloadMessage ?? localize('reload message', "Switching a settings profile requires reloading VS Code."),
message: reloadMessage ?? localize('reload message', "Switching a profile requires reloading VS Code."),
primaryButton: localize('reload button', "&&Reload"),
});
if (result.confirmed) {

View File

@@ -9,7 +9,7 @@ import { areSameExtensions } from 'vs/platform/extensionManagement/common/extens
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { ILogService } from 'vs/platform/log/common/log';
import { EnablementState, IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IResourceProfile } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
interface IProfileExtension {
identifier: IExtensionIdentifier;
@@ -17,7 +17,7 @@ interface IProfileExtension {
disabled?: boolean;
}
export class ExtensionsProfile implements IResourceProfile {
export class ExtensionsResource implements IProfileResource {
constructor(
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@@ -27,12 +27,12 @@ export class ExtensionsProfile implements IResourceProfile {
) {
}
async getProfileContent(): Promise<string> {
async getContent(): Promise<string> {
const extensions = await this.getLocalExtensions();
return JSON.stringify(extensions);
}
async applyProfile(content: string): Promise<void> {
async apply(content: string): Promise<void> {
const profileExtensions: IProfileExtension[] = JSON.parse(content);
const installedExtensions = await this.extensionManagementService.getInstalled();
const extensionsToEnableOrDisable: { extension: ILocalExtension; enablementState: EnablementState }[] = [];

View File

@@ -7,14 +7,14 @@ import { IStringDictionary } from 'vs/base/common/collections';
import { ILogService } from 'vs/platform/log/common/log';
import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IResourceProfile } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IProfileResource } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { Extensions, IProfileStorageRegistry } from 'vs/workbench/services/userDataProfile/common/userDataProfileStorageRegistry';
interface IGlobalState {
storage: IStringDictionary<string>;
}
export class GlobalStateProfile implements IResourceProfile {
export class GlobalStateResource implements IProfileResource {
constructor(
@IStorageService private readonly storageService: IStorageService,
@@ -22,12 +22,12 @@ export class GlobalStateProfile implements IResourceProfile {
) {
}
async getProfileContent(): Promise<string> {
async getContent(): Promise<string> {
const globalState = await this.getLocalGlobalState();
return JSON.stringify(globalState);
}
async applyProfile(content: string): Promise<void> {
async apply(content: string): Promise<void> {
const globalState: IGlobalState = JSON.parse(content);
await this.writeLocalGlobalState(globalState);
}

View File

@@ -8,7 +8,7 @@ import { ConfigurationScope, Extensions, IConfigurationRegistry } from 'vs/platf
import { IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { Registry } from 'vs/platform/registry/common/platform';
import { IUserDataProfileService, IResourceProfile, ProfileCreationOptions } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IUserDataProfileService, IProfileResource, ProfileCreationOptions } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { removeComments, updateIgnoredSettings } from 'vs/platform/userDataSync/common/settingsMerge';
import { IUserDataSyncUtilService } from 'vs/platform/userDataSync/common/userDataSync';
@@ -16,7 +16,7 @@ interface ISettingsContent {
settings: string;
}
export class SettingsProfile implements IResourceProfile {
export class SettingsResource implements IProfileResource {
constructor(
@IFileService private readonly fileService: IFileService,
@@ -26,21 +26,19 @@ export class SettingsProfile implements IResourceProfile {
) {
}
async getProfileContent(options?: ProfileCreationOptions): Promise<string> {
async getContent(options?: ProfileCreationOptions): Promise<string> {
const ignoredSettings = this.getIgnoredSettings();
const formattingOptions = await this.userDataSyncUtilService.resolveFormattingOptions(this.userDataProfileService.currentProfile.settingsResource);
const localContent = await this.getLocalFileContent();
let settingsProfileContent = updateIgnoredSettings(localContent || '{}', '{}', ignoredSettings, formattingOptions);
let settings = updateIgnoredSettings(localContent || '{}', '{}', ignoredSettings, formattingOptions);
if (options?.skipComments) {
settingsProfileContent = removeComments(settingsProfileContent, formattingOptions);
settings = removeComments(settings, formattingOptions);
}
const settingsContent: ISettingsContent = {
settings: settingsProfileContent
};
const settingsContent: ISettingsContent = { settings };
return JSON.stringify(settingsContent);
}
async applyProfile(content: string): Promise<void> {
async apply(content: string): Promise<void> {
const settingsContent: ISettingsContent = JSON.parse(content);
this.logService.trace(`Profile: Applying settings...`);
const localSettingsContent = await this.getLocalFileContent();

View File

@@ -66,18 +66,18 @@ export interface IUserDataProfileImportExportService {
setProfile(profile: IUserDataProfileTemplate): Promise<void>;
}
export interface IResourceProfile {
getProfileContent(): Promise<string>;
applyProfile(content: string): Promise<void>;
export interface IProfileResource {
getContent(): Promise<string>;
apply(content: string): Promise<void>;
}
export const ManageProfilesSubMenu = new MenuId('SettingsProfiles');
export const ManageProfilesSubMenu = new MenuId('Profiles');
export const MANAGE_PROFILES_ACTION_ID = 'workbench.profiles.actions.manage';
export const PROFILES_TTILE = { value: localize('settings profiles', "Settings Profiles"), original: 'Settings Profiles' };
export const PROFILES_TTILE = { value: localize('profiles', "Profiles"), original: 'Profiles' };
export const PROFILES_CATEGORY = { ...PROFILES_TTILE };
export const PROFILE_EXTENSION = 'code-profile';
export const PROFILE_FILTER = [{ name: localize('profile', "Settings Profile"), extensions: [PROFILE_EXTENSION] }];
export const PROFILE_FILTER = [{ name: localize('profile', "Profile"), extensions: [PROFILE_EXTENSION] }];
export const PROFILES_ENABLEMENT_CONTEXT = new RawContextKey<boolean>('profiles.enabled', true);
export const CURRENT_PROFILE_CONTEXT = new RawContextKey<string>('currentSettingsProfile', '');
export const IS_CURRENT_PROFILE_TRANSIENT_CONTEXT = new RawContextKey<boolean>('isCurrentSettingsProfileTransient', false);
export const HAS_PROFILES_CONTEXT = new RawContextKey<boolean>('hasSettingsProfiles', false);
export const CURRENT_PROFILE_CONTEXT = new RawContextKey<string>('currentProfile', '');
export const IS_CURRENT_PROFILE_TRANSIENT_CONTEXT = new RawContextKey<boolean>('isCurrentProfileTransient', false);
export const HAS_PROFILES_CONTEXT = new RawContextKey<boolean>('hasProfiles', false);

View File

@@ -8,19 +8,19 @@ import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { ExtensionsProfile } from 'vs/workbench/services/userDataProfile/common/extensionsProfile';
import { GlobalStateProfile } from 'vs/workbench/services/userDataProfile/common/globalStateProfile';
import { ExtensionsResource } from 'vs/workbench/services/userDataProfile/common/extensionsResource';
import { GlobalStateResource } from 'vs/workbench/services/userDataProfile/common/globalStateResource';
import { IUserDataProfileTemplate, IUserDataProfileImportExportService, PROFILES_CATEGORY, IUserDataProfileManagementService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { SettingsProfile } from 'vs/workbench/services/userDataProfile/common/settingsProfile';
import { SettingsResource } from 'vs/workbench/services/userDataProfile/common/settingsResource';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
export class UserDataProfileImportExportService implements IUserDataProfileImportExportService {
readonly _serviceBrand: undefined;
private readonly settingsProfile: SettingsProfile;
private readonly globalStateProfile: GlobalStateProfile;
private readonly extensionsProfile: ExtensionsProfile;
private readonly settingsResourceProfile: SettingsResource;
private readonly globalStateProfile: GlobalStateResource;
private readonly extensionsProfile: ExtensionsResource;
constructor(
@IInstantiationService instantiationService: IInstantiationService,
@@ -29,15 +29,15 @@ export class UserDataProfileImportExportService implements IUserDataProfileImpor
@IUserDataProfileManagementService private readonly userDataProfileManagementService: IUserDataProfileManagementService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
) {
this.settingsProfile = instantiationService.createInstance(SettingsProfile);
this.globalStateProfile = instantiationService.createInstance(GlobalStateProfile);
this.extensionsProfile = instantiationService.createInstance(ExtensionsProfile);
this.settingsResourceProfile = instantiationService.createInstance(SettingsResource);
this.globalStateProfile = instantiationService.createInstance(GlobalStateResource);
this.extensionsProfile = instantiationService.createInstance(ExtensionsResource);
}
async exportProfile(options?: { skipComments: boolean }): Promise<IUserDataProfileTemplate> {
const settings = await this.settingsProfile.getProfileContent(options);
const globalState = await this.globalStateProfile.getProfileContent();
const extensions = await this.extensionsProfile.getProfileContent();
const settings = await this.settingsResourceProfile.getContent(options);
const globalState = await this.globalStateProfile.getContent();
const extensions = await this.extensionsProfile.getContent();
return {
settings,
globalState,
@@ -60,13 +60,13 @@ export class UserDataProfileImportExportService implements IUserDataProfileImpor
}, async progress => {
await this.userDataProfileManagementService.createAndEnterProfile(name);
if (profileTemplate.settings) {
await this.settingsProfile.applyProfile(profileTemplate.settings);
await this.settingsResourceProfile.apply(profileTemplate.settings);
}
if (profileTemplate.globalState) {
await this.globalStateProfile.applyProfile(profileTemplate.globalState);
await this.globalStateProfile.apply(profileTemplate.globalState);
}
if (profileTemplate.extensions) {
await this.extensionsProfile.applyProfile(profileTemplate.extensions);
await this.extensionsProfile.apply(profileTemplate.extensions);
}
});
@@ -79,13 +79,13 @@ export class UserDataProfileImportExportService implements IUserDataProfileImpor
title: localize('profiles.applying', "{0}: Applying...", PROFILES_CATEGORY.value),
}, async progress => {
if (profile.settings) {
await this.settingsProfile.applyProfile(profile.settings);
await this.settingsResourceProfile.apply(profile.settings);
}
if (profile.globalState) {
await this.globalStateProfile.applyProfile(profile.globalState);
await this.globalStateProfile.apply(profile.globalState);
}
if (profile.extensions) {
await this.extensionsProfile.applyProfile(profile.extensions);
await this.extensionsProfile.apply(profile.extensions);
}
});
this.notificationService.info(localize('applied profile', "{0}: Applied successfully.", PROFILES_CATEGORY.value));

View File

@@ -12,7 +12,7 @@ import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
import { DidChangeUserDataProfileEvent, IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
const defaultUserDataProfileIcon = registerIcon('defaultSettingsProfiles-icon', Codicon.settings, localize('settingsProfilesIcon', 'Icon for Default Settings Profiles.'));
const defaultUserDataProfileIcon = registerIcon('defaultProfile-icon', Codicon.settings, localize('defaultProfileIcon', 'Icon for Default Profile.'));
export class UserDataProfileService extends Disposable implements IUserDataProfileService {

View File

@@ -55,7 +55,7 @@ export function getSyncAreaLabel(source: SyncResource): string {
case SyncResource.Tasks: return localize('tasks', "User Tasks");
case SyncResource.Extensions: return localize('extensions', "Extensions");
case SyncResource.GlobalState: return localize('ui state label', "UI State");
case SyncResource.Profiles: return localize('settings profiles', "Settings Profiles");
case SyncResource.Profiles: return localize('profiles', "Profiles");
}
}