Collapse all methods in Visual Studio Code [duplicate]

In Visual Studio Professional, we have a shortcut key, Ctrl + M Ctrl + O to collapse all methods and properties in a class. How can I do a similar thing in Visual Studio Code?

I know there are shortcut keys like Ctrl + Shift + [, but this does not meet the needs.

Is it possible to get the Visual Studio Professional-like behaviour in Visual Studio Code?


  • Fold All:

    • Windows: Ctrl + K Ctrl + 0
    • Mac: + K + 0
  • Unfold All:

    • Windows: Ctrl + K Ctrl + J
    • Mac: + K + J

To see all available shortcuts in the editor:

  • Windows: Ctrl + K Ctrl + S
  • Mac: + K + S

Screenshot of Visual Studio keyboard shortcuts

All shortcuts kept up to date by the Visual Studio Code team: Visual Studio Code Shortcuts


  • Ctrl + K + 0: fold all levels (namespace, class, method, and block)
  • Ctrl + K + 1: namspace
  • Ctrl + K + 2: class
  • Ctrl + K + 3: methods
  • Ctrl + K + 4: blocks
  • Ctrl + K + [ or Ctrl + k + ]: current cursor block
  • Ctrl + K + j: UnFold

Like this ? (Visual Studio Code version 0.10.11)

Fold All (Ctrl+K Ctrl+0)

Unfold All (Ctrl+K Ctrl+J)

Fold Level n (Ctrl+K Ctrl+N)


The beauty of Visual Studio Code is

Ctrl + Shift + P

Hit it and search anything you want.

In your case, hit Ctrl + Shift + P and type fold all.


Mac Users

Fold Commands

enter image description here

Unfold commands enter image description here