Simple, does what I want it to do. I have a solution with 50+ projects in it. Whenever I transfer the code base between locations, VS has all projects open making it difficult to navigate the solution tree to fine the files I need to work on. Now it's just one click to find the project I want.
Exactly what I need :) It would be nice if it was a bit smarter, so if all were collapsed, we could expand them. But if at lease one project was expanded, it would collapse. SOme sort of toggle.
Not bad but it flickers a lot because it first collapses the children and then the parent.
"Collapse Selection In Solution Explorer" is faster because it actually collapses the parent first and then goes through the children but you don't see it.
I installed NCrunch and found it had stolen the CTRL+SHIFT+Q key binding. I removed it from Tools->Options->Keyboard but sadly it still won't work. Uninstalling and re-installing Collapse Solution hasn't helped. Even uninstalling NCrunch completely hasn't brought it back.
How can I get it to reset and for CTRL+SHIFT+Q to collapse the solution again? It'd be a good idea to implement the necessary bits for Collapse Solution's keyboard bindings in the standard Visual Studio options dialog to avoid conflicts.
When I right click a solution folder, there is no "Collapse ..." item. The only way for me to collapse solution folders is to collapse the whole solution! I am using version 2.0.0.
if I select a folder containing 20 projects for collapse, all folders are collapsed. How about only projects inside do that way?
Anyway, good piece of work!
Thanks,
Ben
Anytime you select a single project (right click in Solution Explorer) just that project should collapse. If you choose a solution folder then all project (and nested files) in that folder should collapse.
If that's not the behavior you're experiencing please let me know.
I looked in the report that solution folders were not being collapsed but I wasn't able to reproduce the issue.
We tested the extension against two different solutions on two different machines.
If anyone can describe how to reproduce the problem please reply to this discussion with the steps.
Thanks.
We identified an issue with projects nested within a solution folder. An exception was thrown if you tried to collapse a project that was in a solution folder.
Version 1.4 fixes the bug.
updated to the latest version 1.5
much much better, i like how fast it works. much better then a macro.
but still...
in my solution i got several nested solution folders and while collapsing the solution not all projects and folders collapsed.
Shemeshi,
Can you give me an example so I can replicate what your experiencing? It would be helpful to know if the type of project (c#, vb, setup, etc) and the nesting order. For example, Solution->C# Project->Folder->C#Project.
If I can replicate the issue that I should be able to adjust the code to handle it. There are a few quirks in dealing with UI automation so any more info you provide would be really helpful.
Thanks for your feedback.
OK...
silverlight c#...
then a mix up: solution > SL project folder... solution > folder > folder > SL project...
i noticed that everything is collapsed EXCEPT the expanded projects.
if a project is expanded everything underneath it
again...
updated to version 1.6 (keep up the good work! it will be a great extension when stable)
the problem remains!
using "Collapse Project" works excellent: everything is collapsed including the project itself.
but when using "Collapse Solution" opened projects remain opened.
Cory hi,
1 - any progress on this?
2 - can you make an extension to "find file in solution explorer"? when clicked the solution explorer will select the file and expand its folders.
I'm working a new way to collapse items but updates isn't ready yet. I know that the "Is Expanded" property doesn't always work - usually when the item is nested in a solution folder. Hopefully, v1.7 will be ready by weeks end.
As for the "Find Files" suggestion, it sounds like a good idea. I think it has been done already. I searched the gallery for the term "Find" and found "VS 2008 File Finder". Also, other have mentioned DPack as an alternative.
I have been able to recreate the issue and I am working on a fix.
Under the following solution hierarchy items in the folder or project will not be collapsed if the user selects "Collapse Solution" from the solution node context menu.
Solution->Solution Folder->Solution Folder->Solution Folder->Project
Shemeshi, after upgrading to version 1.7 please let me know if the issue was corrected. I have a test solution with lots of nested solution folders, a dozen projects (of various types), and a variety of items in the project. In my test, everything collapses as expected.
Thanks again for your feedback.
Sorry Cory,
version 1.7 is even worse!
"Collapse Project" is not working at all!
"Collapse Solution" is collapsing the solution folders but the projects inside remains open!
version 1.6 was better!
here are the two macros i use today, they both work PERFECT (but bit slow)!
first - locate file in solution explorer:
Public Sub LocateFileInSolutionExplorer()
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
DTE.ExecuteCommand("View.SolutionExplorer")
End Sub
second - collapse the solution explorer tree:
Sub CollapseTree()
' Get the the Solution Explorer tree
Dim solutionExplorer As UIHierarchy
solutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
' Check if there is any open solution
If (solutionExplorer.UIHierarchyItems.Count = 0) Then
Return
End If
' Get the top node (the name of the solution)
Dim rootNode As UIHierarchyItem = solutionExplorer.UIHierarchyItems.Item(1)
rootNode.DTE.SuppressUI = True
' Collapse each project node
Collapse(rootNode, solutionExplorer)
' Select the solution node, or else when you click
' on the solution window
' scrollbar, it will synchronize the open document
' with the tree and pop
' out the corresponding node which is probably not what you want.
rootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
rootNode.DTE.SuppressUI = False
End Sub
Private Sub Collapse(ByVal item As UIHierarchyItem, ByRef solutionExplorer As UIHierarchy)
For Each innerItem As UIHierarchyItem In item.UIHierarchyItems
If innerItem.UIHierarchyItems.Count > 0 Then
' Re-cursive call
Collapse(innerItem, solutionExplorer)
' Collapse
If innerItem.UIHierarchyItems.Expanded Then
innerItem.UIHierarchyItems.Expanded = False
If innerItem.UIHierarchyItems.Expanded = True Then
' Bug in VS 2005
innerItem.Select(vsUISelectionType.vsUISelectionTypeSelect)
solutionExplorer.DoDefaultAction()
End If
End If
End If
Next
End Sub
If you can please send me a sample solution to cory cissell at hotmail com. All my test cases work with version 1.7 so there must be a scenario that's not accounted for.
Thanks.
I installed the extension in VS2010 successfully, but the Collapse Solution doesn't show up in the menu. I'm using Delphi Prism in VS2010. Isn't that supported?
Eric J Peters,
Thanks for the suggestion. I'm working on adding a keyboard short-cut but I hadn't considered having it select the solution node first. That should be an easy to add. Look for it in version 1.9 which should be available by the end of next week (05/21/2010).
Thanks for the feedback.
Version 1.9 was release today (05/19/2010). The key binding "Ctrl Shift Q" will collapse all solution items with having to select a solution node first.
There are a couple of other new features added too. The Description has more information.