Unfold individual elements as needed or use the Unfold All comma. Go to File > Preferences > Keyboard Shortcutsįor example, Change fold shortcut key from ctrl+alt+] to ctrl+alt+F. Todays VS Code command: Fold AllFold all the elements in a file to see a minimal outline.You can still update the custom keyboard bindings using GUI settings. Alt PgUp/PgDown, Scroll page up/down Ctrl Shift, Fold (collapse) region Ctrl Shift, Unfold (uncollapse) region Ctrl K Ctrl, Fold (collapse) all. Ctrl + Shift + Alt + ] in Windows and Linux.Ctrl + Shift + Alt + [ in Windows and Linux The 'Collapse All' function in Visual Studio Code allows users to quickly hide all the code that is currently expanded in the editor.You'll most likely find this more useful than the Collapse All command. Open code file, for example, java code file This shortcut is only available when Visual Studio is not outlining the code into. There are below shortcut commands to do it. Fold Recursively (Ctrl+K Ctrl+ ) folds the innermost expanded region at the cursor and all regions inside that region. How to fold and unfold all code sections in Visual Studio Code Toggle Fold (Ctrl+K Ctrl+L) folds or unfolds the region at the cursor. The associated commands may be useful outside of an editing context, such as in auto generated code, code assistance extensions, etc.This tutorial shows source code sections fold and unfold all in Visual studio code with shortcut commands. While editing code I have a hard time thinking of time where one of these commands would be preferable to “Toggle Outline Expansion” above. These commands will collapse or expand the region under the cursor. This is relatively unintuitive.Įxpand Current Region and Collapse Current Region Ctrl+M, Ctrl+C collapses all comments (and using/Import statements) Ctrl+M, Ctrl+D expands all comments and closes all other areas Ctrl+M, Ctrl+F toggles all. In the example below, if the Constructors region starts closed, typing this command will first open the region, and the command must be executed a second time to actually toggle all outlining. The first time you press Ctrl+ (M,L) if there is a mixture of open and closed sections in the file, the closed sections will be opened as the first step in the toggle. Ctrl+Fold (collapse) all subregionsCtrl+K Ctrl+Unfold (uncollapse) all. 56 Share Save 6.5K views 6 months ago VS Code Tutorials Sign Up (We're free online community, meet other makers) Collapse All in Visual Studio Code. The word toggle suggests that repeating this command will switch outlining back and forth. Visual Studio is a robust IDE that supports all major programming languages. All outlining is collapsed as much as possible.Ĭtrl+ (M,X) – this command works great for expanding everything so all code is visibleĬtrl+ (M,L) this command behaves someone strangely. In the example below this can be used to open and close the constructors region, as well as the Foo and Bar2 types separately.Ĭtrl+ (M, A) In the code below, this command does what you would expect. Pressing this command repeatedly will open and close the region or auto-outlined section under the cursor. Matt Lacey 6,008 installs ( 13) Free Improve the way you work with comments in code by easily (& automatically) expanding and collapsing comments. Toggle Outline Expansion (Edit.ToggleOutlinineExpansion)Įxpand All Outlining (Edit.ExpandAllOutlining)Įxpand Current Region (Edit.ExpandCurrentRegion)Ĭollapse Current Region (Edit.CollapseCurrentRegion)Ĭtrl+ (M,M) – This is probably the shortcut that makes the most sense of this bunch. Imagine a sprawling code file, lines upon lines of intricate logic interwoven with class definitions, method implementations, and an abundance of XML or HTML. Toggle All Outlining (Edit.ToggleAllOutlining) You can look up the shortcut for any command by opening the Options dialog box, expanding the Environment node, and then choosing Keyboard. In the realm of Visual Studio, where code sprawls like a labyrinth, this comprehensive guide unravels the secrets of harnessing the power of 'Collapse All' to conquer the coding universe. Below I explain what each of these does in more detail.Ĭollapse All Outlining ( Edit.CollapseAllOutlining) These Shortcuts have been tested with Visual Studio 2017 15.87 with default settings. Visual Studio has several shortcuts available for expanding and collapsing sections of code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |