views:

196

answers:

3

Is there a way to collapse all documentation headers (/// comments) in the current file in visual studio (2008+)?

+1  A: 

You can try Ctrl+M, Ctrl+O, but that will collapse function bodies as well.

Anton Gogolev
Not exactly what I was looking for, but nice to know. What is the expand all shortcut now that I've collapsed everything in my file? :)
Veli
@Veli: All the stuff you need is available from the Edit menu's Outlining submenu. Ctrl M M collapes / expands the currently active block, be it a comment, class or metod etc.
Ruben Bartelink
+1  A: 

What Anton said.

If what you want is not on Edit|Outlining, you'd need to write a macro or a DxCore plugin to walk it and Ctrl-M M each relevant block.

Ruben Bartelink
yeah I figured that might be the case, I'm too lazy to collapse each one individually, let along write a plugin/macro... though would be a fun exercise if I ever get some free time :)
Veli
@Veli: It is actually a very easy thing to do with DXCore, and there are lots of examples that do very similar traversals of a code tree. Or you could record a temporary macro that does a repeated find of `///` and a `Ctrl M M`. (Yes, I understand you were looking for something OOTB and if someone started stating the obvious like this at me I'd tell them where to go right now!)
Ruben Bartelink
+4  A: 

See my macro for collapsing XML comments which does exactly what you need.

Peter Macej
Very cool. Thanks for sharing!
Veli