Announcing: Collapse Selection in Solution Explorer extension

Announcing: Collapse Selection in Solution Explorer extension

Rate This
  • Comments 31

We have received much feedback asking for a feature that would recursively collapse nodes in the solution explorer. We are happy to announce the Collapse Selection in Solution Explorer extension!

What is the Collapse Selection in Solution Explorer extension?

Many Visual Studio users have a solution tree structure with multiple projects and solution folders that are organized as a deep hierarchy. To avoid visual pollution, users want only those projects expanded that are being actively developed (often with many of the project’s child nodes recursively collapsed). To accomplish this task, they have to manually collapse each node recursively – an onerous chore if one has a deeply nested solution tree. The Collapse Selection in Solution Explorer extension addresses this particular issue by enabling the user to recursively collapse multiple nodes with a single click.

How do I install the extension?

1. You can download the extension from the VS Gallery. Double-click the downloaded VSIX file and the extension will be installed.

2. You can navigate to Tools –> Extension Manager, and search for “Collapse Selection in Solution Explorer” in the Online Gallery. Simply download and click Install.

How does the extension work?

Once the extension is installed, you will see a button appear in the Solution Explorer bar. Choose any collapsible node (any node with children nodes; i.e. parent node) in the Solution Explorer and click the Collapse Selection button. All the children nodes will be recursively collapsed to show only the parent node. When you click the expand/collapse icon next to the just collapsed parent node, the parent node will expand to list all the children nodes which will appear collapsed if they have their own children nodes (see figure below). You can select the solution node and click the Collapse Selection button to recursively collapse all nodes in the solution tree. You can also select multiple collapsible nodes and click the Collapse Selection button to recursively collapse each of them.

image

I prefer using my keyboard. Is it possible to use this extension through keyboard shortcuts?

Definitely. Ensure that the focus is on the Solution Explorer and press Alt + Num(-) to collapse selected nodes. You can also use the Command Window by entering the following command: View.CollapseSelectionInSolutionExplorer.

Is this extension limited to certain project types?

No. This extension should work with all project types.

How can I provide feedback?

We love feedback!

1. Comment on this blog post.

2. Log onto Connect and file a bug.

Luau in Hawaii

 Richa Prasad – Program Manager, Visual Studio Project Team

 Short Bio: I am a PM on the Visual Studio Project System team. I work on many Project features such as conversion, solution load, references, project properties and others. Prior to joining Microsoft, I was a graduate student at University of Washington.

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
  • I'm a bit puzzled about why someone would want this. It's nice and all, but it doesn't address the problem. I've cussed for years every time Visual Studio inexplicably expands hundreds of my carefully and artfully collapsed solution nodes, thereby rendering the solution structure completely unusable and requiring an hour to fix (a task which, unfortunately, this tool cannot help with). The only feature I want is for Visual Studio to *not* change the expansion state of *anything* on its own!

  • Isn't the same functionality available in Visual Studio Powercommands?

  • It does the same thing as the PowerCommands does. Richa, what's the benefit of this tool over PowerCommands?

  • CoolCommands has had this since VS2005.

  • Is this the official workaround for the randomly expanded nodes bug? Why not fix the solution explorer in the first place?

  • Shortcut is Ctrl+Alt+Num(-) !

    Do I miss something ?

  • Shortcut is Ctrl+Alt+Num(-) !

    Do I miss something ?

  • this is EXCELLENT!!

    now... can you plz make an extension to "find file in solution explorer"?!

    if i have a file open i want to see its location in the solution explorer by a simple click.

    today i use this macro (with a keyboard shortcut):

       Public Sub LocateFileInSolutionExplorer()

           DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")

           DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")

           DTE.ExecuteCommand("View.SolutionExplorer")

       End Sub

    it is selecting the opened file and expanding all its parents.

    it does the job but it is slow.

    PLEASE!

  • @Visual Studio User and @Mike Fourie:

    1. Power Command Collapse All extension does not allow *any* collapible node to be collapsed. The Collapse Selection extension does.

    2. You cannot multi-select collapisble nodes with the Power Command Collapse All extension

    @ali62b:

    Thank you for pointing this out. I have edited the blog post to say that the keyboard shortcut is Ctrl + Alt + Num(-)

    @Owen Wengerd and @Dominik:

    When you open a solution for the very first in Visual Studio, the nodes may be expanded. But when you reopen the solution, we should be persisting the state of the node from your last setting; unless you delete the .suo file.

  • @Shemesh: Solution Explorer already has the feature you're looking for (automatically select the item matching the file opened in editor and expand the parents of that item).

    Open the Tools/Options dialog, and expand the nodes in the options tree ProjectsAndSolution/General.

    Make sure you have checked the following option there: "Track active item in Solution Explorer"

    Alin

    [Visual Studio Platform development]

  • @Alin - i do not like this "tracking" option.

    instead i want to simply "find the file in solution explorer"

  • @Shemesh: I see what you mean. I opened a bug on Connect to track the issue, feel free to add more comments to it. connect.microsoft.com/.../no-easy-way-to-re-synchronize-the-selection-in-solutionexplorer-once-track-active-item-has-been-turned-off

    Thanks,

    Alin

  • Can't this be used with Visual Web Developer 2010? I tried installing and it says

    "This extension is not installable on currently installed products".

    Right now i have found a macro online that does collapsing for me.

  • om:  This is because you're running an Express edition, and you'll find it happens not just for this extension or Visual Web Developer Express but for all extensions on all Express versions.  The Express editions of Visual Studio 2010 unfortunately don't support VS extensions.

    Brittany Behrens

    Program Manager, Visual Studio Editor

  • Thanks  Brittany Behrens MSFT.

    But VWD 2010 has Tools->Extension Manager option. So is it of no use ideally?

Page 1 of 3 (31 items) 123