VS Code: Collapse-and-Expand - DEV Community
Có thể bạn quan tâm
I recently had a large amount of data to refactor out of HTML and into JSON. The details about how I achieved this is a whole different article. What I want to document for myself (and maybe others will find it useful, even if it's only a refresher) are the various code expand and collapse options.
Rather than doing things the easy way and combing through the VS Code documentation, I did a search on Stack Overflow and found the following ...
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:
- Ctrl + Shift + [ on Windows and Linux
- ⌥ + ⌘ + [ on macOS
Unfold unfolds the…
And, while this looked exactly like what I was looking for, I found that even a simple answer can have its own complications.
Terminology
It is not called Collapse and Expand, rather Folding.
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, while Unfold unfolds the collapsed region at the cursor.
| Fold Keys | Unfold Keys | System |
|---|---|---|
| Ctrl + Shift + [ | Ctrl + Shift + ] | on Windows and Linux |
| ⌥ + ⌘ + [ | ⌥ + ⌘ + ] | on macOS |
Fold All folds all regions, while Unfold All unfolds all regions in the editor:
| Fold Keys | Unfold Keys | System |
|---|---|---|
| Ctrl + (K => 0) (zero) | Ctrl + (K => J) | on Windows and Linux |
| ⌘ + (K => 0) (**zero(() | ⌘ + (K => J) | on macOS |
NOTE: Watch out for the ZERO listed, it is not an "O" key. Additionally, The K => 0 and K => J are meant to be pressed while the Ctrl and ⌘ are held down. I kept releasing the Ctrl key before pressing the second key while caused some heartache.
As I said before, this is a personal documentation of this process for that point in time when I need this useful information again.
Từ khóa » Visual Studio Collapse All Code Shortcut
-
Collapse All Methods In Visual Studio Code - Stack Overflow
-
How To Collapse All In VS Code - Alphr
-
Collapse And Expand Regions Of Code - Visual Studio (Windows)
-
Collapse And Expand Regions Of Code - Visual Studio - Microsoft Docs
-
Expand/Collapse All - Visual Studio Tips
-
[PDF] Keyboard-shortcuts-windows.pdf - Visual Studio Code
-
Collapse All Functions Visual Studio Code Code Example
-
Visual Studio Code Expand Collapse All Shortcut Key Code Example
-
Visual Studio - Command To Collapse All Sections Of Code?
-
Visual Studio Collapse Extends Regions Only Shortcut
-
How To Collapse All And Expand All Source Code In Visual Studio
-
How To Quickly Collapse Code Blocks In VSCode - LinuxPip
-
Visual Studio Code - Shortcut - Collapse All Fi...anycodings
-
Keyboard Shortcuts For Visual Studio Code - UseTheKeyboard