-
Notifications
You must be signed in to change notification settings - Fork 36k
Allow "Move Editor into Previous Group" to create new group #275968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Allow "Move Editor into Previous Group" to create new group #275968
Conversation
Fixes microsoft#262817 When the active editor is in the leftmost group and there is no previous group, "Move Editor into Previous Group" now creates a new group in the opposite direction of the user's preferred side-by-side setting and moves the editor there. This mirrors the existing behavior of "Move Editor into Next Group". The new group is only created if the source group contains 2+ editors, preventing the source group from being left empty. The direction respects the `workbench.editor.openSideBySideDirection` setting - if the preference is RIGHT (horizontal), the new group is created to the LEFT; if DOWN (vertical), the new group is created UP.
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the behavior of the moveActiveEditor command for the 'previous' case. When moving an editor to a previous group and no previous group exists, the code now creates a new group in the opposite direction of the user's preferred side-by-side direction, but only when the source group has 2 or more editors.
Key changes:
- Added logic to create a new group when moving to 'previous' and no previous group exists
- The new group is created in the opposite direction (LEFT if preferred is RIGHT, UP if preferred is DOWN)
- This behavior only activates when the source group has at least 2 editors
| // If no previous group exists and source group has 2+ editors, create a new group to the left/up | ||
| if (!targetGroup && sourceGroup.count >= 2) { |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'previous' case has a sourceGroup.count >= 2 condition before creating a new group, but the 'next' case (line 310-312) creates a new group without this condition. This creates an asymmetry where moving to 'next' will always create a group if none exists, but moving to 'previous' only creates a group if there are 2+ editors. Consider whether this asymmetry is intentional or if the behavior should be consistent between 'next' and 'previous' cases.
| // If no previous group exists and source group has 2+ editors, create a new group to the left/up | |
| if (!targetGroup && sourceGroup.count >= 2) { | |
| // If no previous group exists, create a new group to the left/up | |
| if (!targetGroup) { |
| break; | ||
| case 'previous': | ||
| targetGroup = editorGroupsService.findGroup({ location: GroupLocation.PREVIOUS }, sourceGroup); | ||
| // If no previous group exists and source group has 2+ editors, create a new group to the left/up |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says "create a new group to the left/up" but the actual direction depends on the user's workbench.editor.openSideBySideDirection setting. Consider clarifying: "create a new group in the opposite direction (left if preferred direction is right, up if preferred direction is down)".
| // If no previous group exists and source group has 2+ editors, create a new group to the left/up | |
| // If no previous group exists and source group has 2+ editors, create a new group in the opposite direction (left if preferred direction is right, up if preferred direction is down) |
|
I commented about this feature in #262817 (comment) |
Fixes #262817
When the active editor is in the first group and there is no previous group, "Move Editor into Previous Group" now creates a new group before the current group, and moves the editor there. This mirrors the existing behavior of "Move Editor into Next Group".
The new group is only created if the source group contains 2+ editors, preventing the source group from being left empty. The direction respects the
workbench.editor.openSideBySideDirectionsetting - if the preference is RIGHT (horizontal), the new group is created to the LEFT; if DOWN (vertical), the new group is created UP.Suggestions on where to add tests for this would be appreciated.