Skip to content

Commit

Permalink
Show Labels and Toggle Action (#231275)
Browse files Browse the repository at this point in the history
* Show LabelS and toggle action

* 💄
  • Loading branch information
benibenj authored Oct 14, 2024
1 parent 6cf71ea commit cd9001b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/vs/workbench/browser/parts/panel/panelPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class PanelPart extends AbstractPaneCompositePart {
);

this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('workbench.panel.showLabel')) {
if (e.affectsConfiguration('workbench.panel.showLabels')) {
this.updateCompositeBar(true);
}
}));
Expand Down Expand Up @@ -134,7 +134,7 @@ export class PanelPart extends AbstractPaneCompositePart {
pinnedViewContainersKey: 'workbench.panel.pinnedPanels',
placeholderViewContainersKey: 'workbench.panel.placeholderPanels',
viewContainersWorkspaceStateKey: 'workbench.panel.viewContainersWorkspaceState',
icon: this.configurationService.getValue('workbench.panel.showLabel') === false,
icon: this.configurationService.getValue('workbench.panel.showLabels') === false,
orientation: ActionsOrientation.HORIZONTAL,
recomputeSizes: true,
activityHoverOptions: {
Expand Down Expand Up @@ -165,11 +165,19 @@ export class PanelPart extends AbstractPaneCompositePart {
createAndFillInContextMenuActions(panelPositionMenu, { primary: [], secondary: positionActions });
createAndFillInContextMenuActions(panelAlignMenu, { primary: [], secondary: alignActions });

const panelShowLabels = this.configurationService.getValue<boolean | undefined>('workbench.panel.showLabels');
const toggleShowLabelsAction = toAction({
id: 'workbench.action.panel.toggleShowLabels',
label: panelShowLabels ? localize('showIcons', "Show Icons") : localize('showLabels', "Show Labels"),
run: () => this.configurationService.updateValue('workbench.panel.showLabels', !panelShowLabels)
});

actions.push(...[
new Separator(),
new SubmenuAction('workbench.action.panel.position', localize('panel position', "Panel Position"), positionActions),
new SubmenuAction('workbench.action.panel.align', localize('align panel', "Align Panel"), alignActions),
toAction({ id: TogglePanelAction.ID, label: localize('hidePanel', "Hide Panel"), run: () => this.commandService.executeCommand(TogglePanelAction.ID) })
toggleShowLabelsAction,
toAction({ id: TogglePanelAction.ID, label: localize('hidePanel', "Hide Panel"), run: () => this.commandService.executeCommand(TogglePanelAction.ID) }),
]);
}

Expand Down
5 changes: 2 additions & 3 deletions src/vs/workbench/browser/workbench.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,10 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
'default': 'left',
'description': localize('sideBarLocation', "Controls the location of the primary side bar and activity bar. They can either show on the left or right of the workbench. The secondary side bar will show on the opposite side of the workbench.")
},
'workbench.panel.showLabel': {
'workbench.panel.showLabels': {
'type': 'boolean',
'default': true,
'included': false,
'description': localize('panelShowLabel', "Controls whether activity items in the panel title are shown as label or icon."),
'description': localize('panelShowLabels', "Controls whether activity items in the panel title are shown as label or icon."),
},
'workbench.panel.defaultLocation': {
'type': 'string',
Expand Down

0 comments on commit cd9001b

Please sign in to comment.