Skip to content

Allow configuring the secondary side bar location#320701

Open
AlejandroRomeroG wants to merge 2 commits into
microsoft:mainfrom
AlejandroRomeroG:feature/secondary-sidebar-location
Open

Allow configuring the secondary side bar location#320701
AlejandroRomeroG wants to merge 2 commits into
microsoft:mainfrom
AlejandroRomeroG:feature/secondary-sidebar-location

Conversation

@AlejandroRomeroG

@AlejandroRomeroG AlejandroRomeroG commented Jun 9, 2026

Copy link
Copy Markdown

This adds a workbench.secondarySideBar.location setting with opposite, left, and right values. opposite remains the default, so the existing behavior is preserved unless the setting is changed. The workbench layout, secondary side bar context menu, customize layout icon, and editor drag auto-open behavior now use the resolved secondary side bar position instead of assuming it is always opposite the primary side bar.

The motivation is to support workflows where the primary and secondary side bars should stay on the same side of the workbench. This came out of an initial Positron PR, posit-dev/positron#14148, where the goal was to support an RStudio-style layout with the editor and console on the left and related workspace views grouped on the right. That layout was difficult to express while the secondary side bar was always tied to the opposite side of the primary side bar.

Validation: I ran git diff --check. The initial Positron version of this change was also packaged and smoke-tested in a local Positron build, including launching the packaged app, moving the secondary side bar to the same side as the primary side bar, and verifying the session, variables, plots, file explorer, and console layout behaved as expected. I also attempted to install dependencies in this VS Code checkout so I could run npm run compile-check-ts-native, but npm ci failed locally while compiling native dependencies because the macOS toolchain could not find the C++ standard library header <unordered_set>.

Fixes #281828.

Copilot AI review requested due to automatic review settings June 9, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new configuration option to control the secondary side bar’s location (left/right/opposite) and updates layout + actions to compute the auxiliary bar position from this setting.

Changes:

  • Introduce workbench.secondarySideBar.location setting + SecondarySideBarLocation enum.
  • Centralize auxiliary bar position resolution via auxiliaryBarPositionFromConfiguration(...) and apply across workbench/layout parts.
  • Update layout actions/menus/context to support moving/toggling the secondary side bar independently of the primary side bar.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/services/layout/browser/layoutService.ts Adds new setting key, enum, and helper to resolve auxiliary bar position from config.
src/vs/workbench/browser/workbench.ts Uses resolved auxiliary bar position when creating the auxiliary bar part container classes.
src/vs/workbench/browser/workbench.contribution.ts Registers the new configuration schema for workbench.secondarySideBar.location.
src/vs/workbench/browser/parts/editor/editorPart.ts Uses resolved auxiliary bar position when deciding which part to reveal at a given position.
src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.ts Updates styling/menu behavior to respect configurable auxiliary bar placement.
src/vs/workbench/browser/layout.ts Updates class management + grid movement logic to support auxiliary bar on either side.
src/vs/workbench/browser/actions/layoutActions.ts Adds commands/context rules to move/toggle secondary side bar position and updates menu items/icons.

Comment on lines +165 to +177
async run(accessor: ServicesAccessor): Promise<void> {
const layoutService = accessor.get(IWorkbenchLayoutService);
const configurationService = accessor.get(IConfigurationService);

const position = auxiliaryBarPositionFromConfiguration(
layoutService.getSideBarPosition(),
configurationService.getValue<SecondarySideBarLocation>(secondarySideBarPositionConfigurationKey)
);

if (position !== this.position) {
return configurationService.updateValue(secondarySideBarPositionConfigurationKey, positionToString(this.position));
}
}
Comment on lines +101 to +115
const SecondarySideBarLeftContext = ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${secondarySideBarPositionConfigurationKey}`, SecondarySideBarLocation.LEFT),
ContextKeyExpr.and(
ContextKeyExpr.equals(`config.${secondarySideBarPositionConfigurationKey}`, SecondarySideBarLocation.OPPOSITE),
ContextKeyExpr.equals(`config.${sidebarPositionConfigurationKey}`, 'right')
)
)!;

const SecondarySideBarRightContext = ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${secondarySideBarPositionConfigurationKey}`, SecondarySideBarLocation.RIGHT),
ContextKeyExpr.and(
ContextKeyExpr.equals(`config.${secondarySideBarPositionConfigurationKey}`, SecondarySideBarLocation.OPPOSITE),
ContextKeyExpr.equals(`config.${sidebarPositionConfigurationKey}`, 'left')
)
)!;
Comment on lines +121 to +130
export function auxiliaryBarPositionFromConfiguration(sideBarPosition: Position, secondarySideBarLocation: SecondarySideBarLocation | undefined): Position {
switch (secondarySideBarLocation) {
case SecondarySideBarLocation.LEFT:
return Position.LEFT;
case SecondarySideBarLocation.RIGHT:
return Position.RIGHT;
default:
return sideBarPosition === Position.LEFT ? Position.RIGHT : Position.LEFT;
}
}
@AlejandroRomeroG

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Secondary Side Bar to be on the same side as primary side bar

4 participants