I am working with some third-party code that has a lot of conditional macros. Visual Studio is quite good at detecting the inactive code, i.e. code wrapped in #if
...#endif
that won't be compiled and I can manually collapse these individually.
I would like to hide the inactive blocks automatically - all of them. Is this possible?
EDIT: is this possible with VS2012? May be a reason to upgrade.
(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. (C++) Collapses a region in the function containing the insertion point.
How to Collapse All Source Code in VS Code? To fold all top-level and child elements of your code: Enter the command >fold and hit Enter.
How do I minimize all functions in Visual Studio? CTRL + M + O will collapse all.
Fold (Ctrl+Shift+[) folds the innermost uncollapsed region at the cursor. Unfold (Ctrl+Shift+]) unfolds the collapsed region at the cursor. Toggle Fold (Ctrl+K Ctrl+L) folds or unfolds the region at the cursor.
I am not aware of a way to automatically collapse, but there is definitely a setting to hide inactive blocks.
The setting is under Tools->Options->Text Editor->C/C++->View
From there, just change "Show Inactive Blocks" to False.
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