I would like to know if there exists some way to collapse and unfold by levels in Visual Studio. I already know these keys:
They work, but they collapse and unfold to the maximum possible level. I want for example unfold at lvl 2, lvl 3 depth, then collapse to lvl 1, etc.
An example of this functionality exists in Notepad++ editor:
If this functionality is provided by an extension, it'd be good to know the name of this extension.
Select the section of code. Press Ctrl+M+H – Turn on the collapsible/expandable option.
(Ctrl+M, Ctrl+P) - Removes all outlining information for the entire document. (Ctrl+M, Ctrl+U) - Removes the outlining information for the currently selected user-defined region. Not available in Visual Basic. (Ctrl+M, Ctrl+O) - Collapses the members of all types.
In VSCode terminology, the collapsible code blocks feature is called Fold/Unfold. You can quickly fold a block of code, given that your cursor is placed inside of it by pressing Ctrl+Shift+[ keyboard combination. Similar to that, Ctrl+Shift+] key combination will unfold the collapsed region at the cursor.
Use Shift + Click on the folding icon to fold or unfold the region and all regions inside. You can also use the following actions: Fold (Ctrl+Shift+[) folds the innermost uncollapsed region at the cursor.
It's useful to note that, if you first do Collapse All Outlining (Ctrl+M, A), then you can expand/collapse regions one level at a time, for example by using the mouse or the Toggle Outlining Expansion shortcut (Ctrl+M, M). Not as good as expanding/collapsing by n levels, but better than nothing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With