microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.36k stars 28.92k forks source link

Add "Expand All" Button to Tree (make "Collapse All" toggleable) #88682

Closed niderhoff closed 1 year ago

niderhoff commented 4 years ago

Hello,

as of now it is possible to conveniently collapse all tree nodes using the "collapse all" button in the action toolbar of the tree view. However, there is no button for the opposite action ("expand all").

One solution would be to make this button into a toggle. And I suppose that I am not the only one who tried to click the collapse all button again to expand the whole tree again, so it would be quite a natural user experience I suppose.

Is there already an Issue regarding this? I couldn't find one for the life of me. Basically we need #85428 for the explorer.

vscodebot[bot] commented 4 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

gjsjohnmurray commented 4 years ago

Discussed in #66811

isidorn commented 4 years ago

This is a fair feature request which I like, however we do not have it on our immediate plan. Thus assigning to backlog candidates and we might add this in the future. Thanks

vscodebot[bot] commented 4 years ago
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle). Happy Coding!
fbehrens commented 4 years ago

Not so sure, but this may be useful, even for only see that there is a useful feature waiting to be implemented.

I see another possibility which may be very useful (at least to me) while avoiding unintended performance problems, when there are so many files:

When i type in the Explorer then I can quickly jump to matching files. When I then click on Enable filter on type this unfortunately shows only files in already opened folders. To me this is unexpected, as I want to filter from all my files.

Maybe when using this toggle the explorer can be populated fully for this search, while keeping the toggle state in the explorer. Thanks

lnogueir commented 3 years ago

I think this is also applicable to the Variable section when debugging. If the variable I'm analyzing is an array or object, I have to manually open every single entry. It would be much more convenient if there was an 'Expand All' button that opens each entry of the object/array.

The image below describes what I mean: image

It would be very nice if there was an 'Expand All' button on every expandable (root) variable. In fact, this feature is present in other IDEs.

patrickhlauke commented 3 years ago

for what it's worth, i'd love to see this as well - the lack of an "expand all" control is real pain when flitting between large projects that all have their odd deeply-nested structures

MightyPen commented 3 years ago

Without this enhancement, the feature does not scale well.

Would also be nice if we could Copy the list, then Paste it into Excel (tab-delimited, not comma-delimited). Presently we cannot Copy the list at all. :-(

GeneMi (= MightyPen)

obar1 commented 3 years ago

+1 to this in general and if possible add option called focus mode or something like that:

JacksonKearl commented 3 years ago

Alt-Click on the Collapse-All button could toggle it to expand either one or all layers.

ahdung commented 2 years ago

Any news?

jzyrobert commented 2 years ago

Hello 👋 I've given this a go by mimicking the search behaviour of swapping between an "Expand All" and "Collapse All" depending on the explorer state. Feel free to leave any feedback on the behaviour/code

lramos15 commented 2 years ago

Reopening this as there are some UX questions for expand all left. The toggle button seems great but file systems are async. Whether it be going to a remote resource, or cyclical symlinks expansion of all nodes can be very expensive. From my understand the largest use case here is filtering?

sguilliaci commented 1 year ago

Tree views currently support the showCollapseAll option (Whether to show collapse all action or not).

It would be nice if there was an analogous showExpandAll option like in this issue?

lramos15 commented 1 year ago

@sguilliaci Mind sharing the use case you have in mind for expand all? I'm trying to better understand so I can implement the feature well. Wouldn't a fully expanded tree be super noisy?

sguilliaci commented 1 year ago

@lramos15 We'd like to expand all top-level elements one level deep. Allowing extensions to specify depth level might avoid having noisy trees. Our use case is to display the details of user's latest pipelines in their CI. Tree is paginated anyway to it limits noisiness.

Today, extensions that are willing to have expandAll must also implement collapseAll, because the showCollapseAll setting cannot be changed after the tree view creation: extensions cannot use showCollapseAll only when at least one item is collapsible.

Because the opposite of reveal() does not exist (no .collapse() API yet), and because vscode only takes TreeItemCollapsibleState into account for new items only, implementing collapseAll and expandAll is a tough task.

Note that extensions might need to know whether everything is collapsed or expanded in order to consistently populate the TreeItemCollapsibleState of new items.

lramos15 commented 1 year ago

@joaomoreno Maybe I misinterpreted this original issue. It sounds like the request is for a generalized expansion functionality that can be optionally added to any tree

joaomoreno commented 1 year ago

Wouldn't a fully expanded tree be super noisy?

Not only super noisy, but costly for some and event impossible for some others. Expanding everything in the Explorer from a large workspace will be very expensive. And async data trees can be infinitely recursive, like a variable inspector showing an object with a circular dependency.

jerviscui commented 1 year ago

Is there an extension available for this feature now?

sguilliaci commented 1 year ago

@joaomoreno I understand we can't have ExpandAll on the explorer, but the request is slightly different:

lramos15 commented 1 year ago

Closing this as out of scope as it seems like the root solution to this is actually https://github.com/microsoft/vscode/issues/66971 since the expansion is only necessary to get search to work.

If there is an ask for extension contributed views to support expand all please file that separately as this issue seems to be a mix of explorer and all trees making it hard to tackle as they're different items.

vscodenpa commented 1 year ago

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

ffMathy commented 7 months ago

@lramos15 I think this should be reconsidered. I disagree with the premise for closing it.

For instance, in the test runner I have, there's a tag called "open", which allows me to filter tests that are currently open in the editor. I can combine that with the "failed" tag also to narrow it even further down.

Let's say that brings me to 5 different test files that I am currently working on. Because these are nested a lot, I need to manually expand all the tests to see their status at a glance while I am in "Continuous Run Mode", instead of just being able to expand their status directly.

With this in mind, I hope you can see that most people here (including those voting 👎 on the triage bot comment) have other use-cases in mind.