Reputation: 19305
Is there a command/macro/keyboard shortcut that will expand the region where the cursor is and expand all collapsed regions inside it (recursively) ? if not can that be achieved ?
Upvotes: 4
Views: 608
Reputation: 11
I had the same problem, the following worked for me without having to make a macro or a plugin. Note, this is only a partial solution to the problem. I got it to expand recursively underneath a function, but I'm not sure how to reverse it (i.e. recursively collapse everything under the function again). To recursively collapse everything again, I could only figure to use (Ctrl+M, Ctrl+L), which collapses/expands everything in your file, but then you have to drill back down to the function you want.
Firstly, I got everything in a collapsed state by pressing (Ctrl+M, Ctrl+L). You may have to use that combination twice to get everything to collapse. Then I expanded a class and drilled down to the function I wanted to work on.
With the function in its collapsed state, I highlighted the single collapsed row it was on and pressed (Ctrl+M, Ctrl+M).
Doing so recursively expanded everything under the function.
I hope this partial solution helps someone who doesn't want to make a macro or plugin.
Upvotes: 1
Reputation: 1864
I believe ctrl + k
followed by ctrl+]
should unfold all subregions
replacing the ]
with [
should fold all subregions.
Upvotes: -1
Reputation: 4800
As far as I know - No. There isn't a single shortcut that does that.
It's quite easy to create a plugin for Visual Studio that does exactly that:
Few examples to begin with:
Some of the projects are very close to the thing you have in mind, so you might even fork it and do your changes.
:-)
you might get the same result by using Macros for Visual Studio Editor/Recorder:
And then, write a macro like this one or maybe even record the steps you like to "run".
IMO, with recording and playing it will be a little harder to achieve. but I'll be happy to be proved wrong.
Upvotes: 5