Retain maximized group size when adding and removing groups or toggling side bar#137962
Retain maximized group size when adding and removing groups or toggling side bar#137962joaomoreno merged 12 commits intomicrosoft:mainfrom
Conversation
|
The SplitView already supports layout priorities. Could the EditorPart fix this by using layout priorities? Eg: when a view is maximized, set its priority to |
|
Thanks for the quick review, @joaomoreno. There is no setter for priority. I could add one and update vscode/src/vs/base/browser/ui/grid/gridview.ts Lines 1429 to 1431 in 1195fdb However, I don't think I can set it back to vscode/src/vs/base/browser/ui/splitview/splitview.ts Lines 741 to 747 in 1195fdb So I think I'd still need to update the following anyway: vscode/src/vs/base/browser/ui/splitview/splitview.ts Lines 747 to 752 in b9cf83f It's possible that I could revert adding the following code if I set the priority. vscode/src/vs/base/browser/ui/splitview/splitview.ts Lines 1208 to 1209 in 1195fdb However, I'm not sure if it's worth having to add a getter and save the original priority. What do you think? |
|
The grid/splitview can't modify priority, they only read the value. The views themselves set it. The user of the grid (EditorPart) would coordinate across its views and set their priorities accordingly. But on second thought maybe that's too crazy. Let's tackle both issues individually and start with #70083 first. The maximized state isn't preserved across layout calls. If we fix it, we don't want to change the default spltiview behavior, but add/modify an option. What if we have a different type for export enum ProportionalLayout {
Enabled,
DisabledWhenViewMaximized,
Disabled
}
export interface ISplitViewOptions<TLayoutContext = undefined> {
/**
* Resize each view proportionally when resizing the SplitView.
*
* @defaultValue `true`
*/
readonly proportionalLayout?: boolean | ProportionalLayout;
}That way, we can preserve a maximized view's state across As for #137865, the grid/splitview already supports sizing options when adding views. The EditorPart just mostly uses |
|
Thanks for all the details, @joaomoreno. I tried looking into it, but I'm not all the familiar with the code, so I didn't make it too far. I'll try to work on in over the next week. For both issues, I probably still need to add a function to determine if there is a maximized view first, right? For #70083, I'd need to check that if For #70083, essentially, I would keep the following code, but only use it if vscode/src/vs/base/browser/ui/splitview/splitview.ts Lines 748 to 763 in 1195fdb For #137865, what do you think of adding |
|
Hm... After sleeping on it, I'm not entirely sure of my suggestions any more. Your initial PR might actually be a good option moving forward. 🙈 Let's do this: let's add test cases for the new splitview behavior you introduced in this PR. That will help us understand what it introduces and other bugs it might cause, such as unintentional resizing when a view is maximized. Remember that the splitview is used across the workbench in many cases, not just editor grids. |
|
I added test for this. Noting mainly for myself that I can run them with these commands: ./scripts/test.sh --glob **/editorService.test.js
./scripts/test.sh --glob **/splitview.test.jsI wasn't positive if I put the test for #137865 in the right spot, so please let me know if I should move it. I'm pretty new to VS Code and have gotten a grasp of some things enough to fix some things, but don't have a full understanding of the VS Code internal code structure. Is there any documentation I can read on that? In particular, I'm not really sure what the "workbench" vs "editor grid" vs "splitview" terms all mean? |
|
@joaomoreno, do you need me to do anything else on this? |
|
No need for anything else... just need to time to properly look into it. Sorry about that. |
|
No problem. Thanks. Just wanted to be sure I didn't miss something. |
|
I merged main and cleaned up the failing tests after that. |
This reverts commit 61f90de.
This reverts commit 87faa0e.
This reverts commit 1195fdb.
…r toggling side bar" This reverts commit 13ac1bc.
also: keep maximized editor groups, if previously maximized fixes microsoft#70083 fixes microsoft#137865
|
I'm very very sorry to only pick this up right now. I've found the following issues:
While these issues could be fixed with the proposed approach, I went a different direction. I made Additionally, I also made sure to maximize new groups if the reference group was maximized. This fixes #137865. I'll push my changes on top of this PR so we still have you as a contributor, thanks so much for your patience and passion @ssigwart. 🍻 |
|
Thank you, @joaomoreno! |
This PR fixes #137865
This PR fixes #70083
When an editor group is maximized, the active group will remain maximized as you add and remove splits or toggle the side bar.