Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 474
eadam Avatar asked Mar 08 '17 00:03

eadam


People also ask

How do I minimize all methods in visual studio?

CTRL + M + O will collapse all.


2 Answers

  • Fold All:

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

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

To see all available shortcuts in the editor:

  • Windows and Linux: 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

like image 113
pearpages Avatar answered Oct 20 '22 06:10

pearpages


  • 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 image 36
M Komaei Avatar answered Oct 20 '22 06:10

M Komaei