Skip to content

Commit

Permalink
Merge pull request #40559 from pfongkye/issue/40373
Browse files Browse the repository at this point in the history
issue: #40373 default setting for panel location
  • Loading branch information
isidorn authored Dec 22, 2017
2 parents 80b54dc + e0e454a commit b28eec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ configurationRegistry.registerConfiguration({
'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 default 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,
Expand Down
12 changes: 10 additions & 2 deletions src/vs/workbench/electron-browser/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<string>(Workbench.statusbarVisibleConfigurationKey);
Expand All @@ -658,6 +658,12 @@ export class Workbench implements IPartService {
};
}

private setPanelPositionFromStorageOrConfig() {
const defaultPanelPosition = this.configurationService.getValue<string>(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.
*/
Expand Down Expand Up @@ -1084,6 +1090,8 @@ export class Workbench implements IPartService {
this.setSideBarPosition(newSidebarPosition);
}

this.setPanelPositionFromStorageOrConfig();

const fontAliasing = this.configurationService.getValue<string>(Workbench.fontAliasingConfigurationKey);
if (fontAliasing !== this.fontAliasing) {
this.setFontAliasing(fontAliasing);
Expand Down

0 comments on commit b28eec6

Please sign in to comment.