Skip to content

Commit 462ce94

Browse files
authored
Add separator between view actions and global panel actions (fix microsoft#147903) (microsoft#255576)
1 parent 0eb2ec5 commit 462ce94

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/vs/platform/actions/browser/toolbar.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ export interface IToolBarRenderOptions {
301301
* Should the primary group allow for separators.
302302
*/
303303
useSeparatorsInPrimaryActions?: boolean;
304+
305+
/**
306+
* Force a leading separator in the primary actions group.
307+
*/
308+
forceLeadingSeparatorInPrimaryActions?: boolean;
304309
}
305310

306311
export interface IMenuWorkbenchToolBarOptions extends IWorkbenchToolBarOptions {
@@ -369,6 +374,9 @@ export class MenuWorkbenchToolBar extends WorkbenchToolBar {
369374
options?.toolbarOptions?.primaryGroup, options?.toolbarOptions?.shouldInlineSubmenu, options?.toolbarOptions?.useSeparatorsInPrimaryActions
370375
);
371376
container.classList.toggle('has-no-actions', primary.length === 0 && secondary.length === 0);
377+
if (options?.toolbarOptions?.forceLeadingSeparatorInPrimaryActions && primary.length > 0) {
378+
primary.unshift(new Separator());
379+
}
372380
super.setActions(primary, secondary);
373381
};
374382

src/vs/workbench/browser/parts/media/paneCompositePart.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
margin-right: 4px;
1313
}
1414

15+
.monaco-workbench .pane-composite-part > .title > .global-actions .monaco-action-bar .action-item .action-label.separator {
16+
background-color: var(--vscode-disabledForeground);
17+
}
18+
1519
.monaco-workbench .pane-composite-part > .title.has-composite-bar > .title-actions .monaco-action-bar .action-item .action-label {
1620
outline-offset: -2px;
1721
}

src/vs/workbench/browser/parts/paneCompositeBar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export class PaneCompositeBar extends Disposable {
110110
@IWorkbenchLayoutService protected readonly layoutService: IWorkbenchLayoutService,
111111
) {
112112
super();
113+
113114
this.location = paneCompositePart.partId === Parts.PANEL_PART
114115
? ViewContainerLocation.Panel : paneCompositePart.partId === Parts.AUXILIARYBAR_PART
115116
? ViewContainerLocation.AuxiliaryBar : ViewContainerLocation.Sidebar;
@@ -219,6 +220,7 @@ export class PaneCompositeBar extends Disposable {
219220
}
220221

221222
private registerListeners(): void {
223+
222224
// View Container Changes
223225
this._register(this.viewDescriptorService.onDidChangeViewContainers(({ added, removed }) => this.onDidChangeViewContainers(added, removed)));
224226
this._register(this.viewDescriptorService.onDidChangeContainerLocation(({ viewContainer, from, to }) => this.onDidChangeViewContainerLocation(viewContainer, from, to)));

src/vs/workbench/browser/parts/paneCompositePart.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ export abstract class AbstractPaneCompositePart extends CompositePart<PaneCompos
366366
hoverDelegate: this.toolbarHoverDelegate,
367367
hiddenItemStrategy: HiddenItemStrategy.NoHide,
368368
highlightToggledItems: true,
369-
telemetrySource: this.nameForTelemetry
369+
telemetrySource: this.nameForTelemetry,
370+
toolbarOptions: { forceLeadingSeparatorInPrimaryActions: true /* separate from view toolbar */ }
370371
}
371372
));
372373

@@ -452,11 +453,13 @@ export abstract class AbstractPaneCompositePart extends CompositePart<PaneCompos
452453

453454
protected override createHeaderArea(): HTMLElement {
454455
const headerArea = super.createHeaderArea();
456+
455457
return this.createHeaderFooterCompositeBarArea(headerArea);
456458
}
457459

458460
protected override createFooterArea(): HTMLElement {
459461
const footerArea = super.createFooterArea();
462+
460463
return this.createHeaderFooterCompositeBarArea(footerArea);
461464
}
462465

0 commit comments

Comments
 (0)