-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Add Expand all button in explorer view #153614
Add Expand all button in explorer view #153614
Conversation
… workspace root folders are collapsed
Thanks! We're in the process of releasing the next version of VS Code so I'll take a look at this in the coming weeks for next release. Just a an FYI if it seems that i am slow to respond. |
No worries, I am aware of the monthly release cycle |
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.
This looks great and mirrors the search view well. Thanks!
Trying this in today's Insiders, it seems that for a multi-root workspace (for my testing, 2 roots) if I have both roots expanded to some depth, then click collapse, I see first-level folders in all roots and no longer get the option to click collapse a second time to collapse the roots entirely. Instead I am offered an expand option. This is a change of behaviour relative to Stable. |
I think this is sort of expected. Since we wanted people to be able to expand without having their roots fully collapsed. @jzyrobert what are your thoughts here, is there any way we could restore the old behavior while still supporting expand all? |
This is quite different behavior in a multi-root workspace, I have one workspace with 5 root folders and another with 10+, prior to this change clicking the collapse button in explorer would collapse all the folders in each root folder, clicking again would then collapse all the root folders. What I get now is the following:
Perhaps we could have an option to opt-in to this new behavior which seems like it would be perfect in a single root project |
@gjsjohnmurray @lramos15 @StickNitro Sorry I've been busy. I hear your concerns, maybe we should make this a setting? Either for completely disabling it, or to make it so roots are collapsed first before the expand button is shown |
I have updated it so it only shows expand all when all nodes are collapsed. This preserves the double collapse of multi-root. There are still some unanswered questions so I will also be disabling this feature in the stable release until we can have a better story for expand |
This PR fixes #88682
Demo:
vcxsrv_ZwlqrpifFZ.mp4
Added changes:
RawContextKey
ViewHasSomeCollapsibleRootItemContext
that tracks tree status for swapping buttonshasExpandedRootChild
updated to work with a non-workspace tree as wellupdateAnyCollapsedContext
updatesViewHasSomeCollapsibleRootItemContext
usingonDidChangeCollapseState
Action2
that is mostly a copy of "Collapse All"This button behaves like the exact opposite of the "Collapse All" button, and only shows when all root folders in all open workspace folders are collapsed (does not check closed workspace folders)
Other considerations:
onDidChangeCollapseState
, this seems to run for every visible item once, so for a large workspace triggers lots of calls when using "Expand All" or "Collapse All". Could go by the comment of @JacksonKearl to make "Expand All" be the Alt-click action of "Collapse All" so the button does not have to update. (Although I don't know how to get the MouseEvent from inside the Action2run
function)