Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/same remote local color #486

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@
"default": "",
"description": "The Peacock color that will be applied to remote workspaces."
},
"peacock.sameRemoteLocalColor": {
"type": "boolean",
"default": false,
"description": "set same local color on setting remote color"
},
"peacock.showColorInStatusBar": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -440,4 +445,4 @@
"pre-commit": "npm run pretty"
}
}
}
}
4 changes: 4 additions & 0 deletions src/configuration/read-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export function getSurpriseMeOnStartup() {
return readConfiguration<boolean>(StandardSettings.SurpriseMeOnStartup, false);
}

export function getSameRemoteLocalColor() {
return readConfiguration<boolean>(StandardSettings.SameRemoteLocalColor, false);
}

export function getAffectedElements() {
return {
activityBar: readConfiguration<boolean>(AffectedSettings.ActivityBar) || false,
Expand Down
23 changes: 21 additions & 2 deletions src/configuration/update-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import {
isObjectEmpty,
} from '../models';
import { Logger } from '../logging';
import { getFavoriteColors, getColorCustomizationConfigFromWorkspace } from './read-configuration';
import {
getFavoriteColors,
getColorCustomizationConfigFromWorkspace,
getSameRemoteLocalColor,
} from './read-configuration';
import { LiveShareSettings } from '../live-share';

export async function updateGlobalConfiguration(setting: AllSettings, value?: any) {
Expand Down Expand Up @@ -120,16 +124,31 @@ export async function updatePeacockRemoteColorInUserSettings(color: string | und
const section = `${extensionShortName}.${StandardSettings.RemoteColor}`;
return await config.update(section, color, ConfigurationTarget.Global);
}

export async function updatePeacockColorOnly(color: string | undefined) {
const config = vscode.workspace.getConfiguration();
const section = `${extensionShortName}.${StandardSettings.Color}`;
return await config.update(section, color, ConfigurationTarget.Workspace);
}
export async function updatePeacockRemoteColorOnly(color: string | undefined) {
const config = vscode.workspace.getConfiguration();
const section = `${extensionShortName}.${StandardSettings.RemoteColor}`;
return await config.update(section, color, ConfigurationTarget.Workspace);
}
export async function updatePeacockColor(color: string | undefined) {
const config = vscode.workspace.getConfiguration();
const section = `${extensionShortName}.${StandardSettings.Color}`;
if (getSameRemoteLocalColor()) {
await updatePeacockRemoteColorOnly(color);
}
return await config.update(section, color, ConfigurationTarget.Workspace);
}

export async function updatePeacockRemoteColor(color: string | undefined) {
const config = vscode.workspace.getConfiguration();
const section = `${extensionShortName}.${StandardSettings.RemoteColor}`;
if (getSameRemoteLocalColor()) {
await updatePeacockColorOnly(color);
}
return await config.update(section, color, ConfigurationTarget.Workspace);
}

Expand Down
1 change: 1 addition & 0 deletions src/models/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum StandardSettings {
KeepForegroundColor = 'keepForegroundColor',
LightForegroundColor = 'lightForegroundColor',
RemoteColor = 'remoteColor',
SameRemoteLocalColor = 'sameRemoteLocalColor',
ShowColorInStatusBar = 'showColorInStatusBar',
SurpriseMeFromFavoritesOnly = 'surpriseMeFromFavoritesOnly',
SurpriseMeOnStartup = 'surpriseMeOnStartup',
Expand Down