How do I fold or collapse sections of code in Visual Studio Code?
Is this feature supported?
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.
(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.
Folding has been rolled out and is now implemented since Visual Studio Code version 0.10.11. There are these keyboard shortcuts available:
Fold folds the innermost uncollapsed region at the cursor:
Unfold unfolds the collapsed region at the cursor:
Fold All folds all regions in the editor:
Unfold All unfolds all regions in the editor:
References: https://code.visualstudio.com/docs/getstarted/keybindings
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