Allow configuring the secondary side bar location#320701
Open
AlejandroRomeroG wants to merge 2 commits into
Open
Allow configuring the secondary side bar location#320701AlejandroRomeroG wants to merge 2 commits into
AlejandroRomeroG wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
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.locationsetting +SecondarySideBarLocationenum. - 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; | ||
| } | ||
| } |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
workbench.secondarySideBar.locationsetting withopposite,left, andrightvalues.oppositeremains 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 runnpm run compile-check-ts-native, butnpm cifailed locally while compiling native dependencies because the macOS toolchain could not find the C++ standard library header<unordered_set>.Fixes #281828.