From b82299c929c4bd290b75869ae1f2ff36a05de8e0 Mon Sep 17 00:00:00 2001 From: Fong Kye Pascal Date: Wed, 20 Dec 2017 09:16:07 +0100 Subject: [PATCH 1/3] issue: #40373 default setting for panel location --- src/vs/platform/telemetry/common/telemetryUtils.ts | 1 + .../workbench/electron-browser/main.contribution.ts | 6 ++++++ src/vs/workbench/electron-browser/workbench.ts | 12 ++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/telemetry/common/telemetryUtils.ts b/src/vs/platform/telemetry/common/telemetryUtils.ts index 41c3db8d63fd5..5712a44d026e9 100644 --- a/src/vs/platform/telemetry/common/telemetryUtils.ts +++ b/src/vs/platform/telemetry/common/telemetryUtils.ts @@ -153,6 +153,7 @@ const configurationValueWhitelist = [ 'php.validate.run', 'workbench.welcome.enabled', 'workbench.startupEditor', + 'workbench.panel.defaultLocation', ]; export function configurationTelemetry(telemetryService: ITelemetryService, configurationService: IConfigurationService): IDisposable { diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 3c9ed0fa55695..33a442f5a7fd4 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -216,6 +216,12 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = { 'default': 'left', 'description': nls.localize('sideBarLocation', "Controls the location of the sidebar. It can either show on the left or right of the workbench.") }, + 'workbench.panel.defaultLocation': { + 'type': 'string', + 'enum': ['bottom', 'right'], + 'default': 'bottom', + 'description': nls.localize('panelDefaultLocation', "Controls the location of the panel. It can either show at the bottom or on the right of the workbench.") + }, 'workbench.statusBar.visible': { 'type': 'boolean', 'default': true, diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index b621527249309..2301bbcf84411 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -152,6 +152,7 @@ export class Workbench implements IPartService { private static readonly panelHiddenStorageKey = 'workbench.panel.hidden'; private static readonly zenModeActiveStorageKey = 'workbench.zenmode.active'; private static readonly panelPositionStorageKey = 'workbench.panel.location'; + private static readonly defaultPanelPositionStorageKey = 'workbench.panel.defaultLocation'; private static readonly sidebarPositionConfigurationKey = 'workbench.sideBar.location'; private static readonly statusbarVisibleConfigurationKey = 'workbench.statusBar.visible'; @@ -635,8 +636,7 @@ export class Workbench implements IPartService { this.sideBarPosition = (sideBarPosition === 'right') ? Position.RIGHT : Position.LEFT; // Panel position - const panelPosition = this.storageService.get(Workbench.panelPositionStorageKey, StorageScope.WORKSPACE, 'bottom'); - this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM; + this.setPanelPositionFromStorageOrConfig(); // Statusbar visibility const statusBarVisible = this.configurationService.getValue(Workbench.statusbarVisibleConfigurationKey); @@ -658,6 +658,12 @@ export class Workbench implements IPartService { }; } + private setPanelPositionFromStorageOrConfig() { + const defaultPanelPosition = this.configurationService.getValue(Workbench.defaultPanelPositionStorageKey); + const panelPosition = this.storageService.get(Workbench.panelPositionStorageKey, StorageScope.WORKSPACE, defaultPanelPosition); + this.panelPosition = (panelPosition === 'right') ? Position.RIGHT : Position.BOTTOM; + } + /** * Returns whether the workbench has been started. */ @@ -1084,6 +1090,8 @@ export class Workbench implements IPartService { this.setSideBarPosition(newSidebarPosition); } + this.setPanelPositionFromStorageOrConfig(); + const fontAliasing = this.configurationService.getValue(Workbench.fontAliasingConfigurationKey); if (fontAliasing !== this.fontAliasing) { this.setFontAliasing(fontAliasing); From 2f9dbf36f823818edad8e731e2125d8d4fcfd70b Mon Sep 17 00:00:00 2001 From: Fong Kye Pascal Date: Fri, 22 Dec 2017 17:48:41 +0100 Subject: [PATCH 2/3] fix: remove unnecessary line from config --- src/vs/platform/telemetry/common/telemetryUtils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/platform/telemetry/common/telemetryUtils.ts b/src/vs/platform/telemetry/common/telemetryUtils.ts index 5712a44d026e9..41c3db8d63fd5 100644 --- a/src/vs/platform/telemetry/common/telemetryUtils.ts +++ b/src/vs/platform/telemetry/common/telemetryUtils.ts @@ -153,7 +153,6 @@ const configurationValueWhitelist = [ 'php.validate.run', 'workbench.welcome.enabled', 'workbench.startupEditor', - 'workbench.panel.defaultLocation', ]; export function configurationTelemetry(telemetryService: ITelemetryService, configurationService: IConfigurationService): IDisposable { From 936b05827bd6bb62fff27127a23c9b6f473bc1d6 Mon Sep 17 00:00:00 2001 From: Fong Kye Pascal Date: Fri, 22 Dec 2017 17:50:47 +0100 Subject: [PATCH 3/3] docs: rephrase --- src/vs/workbench/electron-browser/main.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 33a442f5a7fd4..a83a621a1e1af 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -220,7 +220,7 @@ let workbenchProperties: { [path: string]: IJSONSchema; } = { 'type': 'string', 'enum': ['bottom', 'right'], 'default': 'bottom', - 'description': nls.localize('panelDefaultLocation', "Controls the location of the panel. It can either show at the bottom or on the right of the workbench.") + 'description': nls.localize('panelDefaultLocation', "Controls the default location of the panel. It can either show at the bottom or on the right of the workbench.") }, 'workbench.statusBar.visible': { 'type': 'boolean',