Daily Dev Tips – Visual Studio Code – how to do Fold/Unfold nicely

Share it with your friends Like

Thanks! Share it with your friends!

Close

In this video, I am showing how you can easily fold  and  unfold multiple levels of code blocks in Visual Studio Code.

Have you ever worked in a large legacy web app? Have you ever seen some of the JavaScript files that contains more than few hundred lines of code  and  sadly with countless nested if / else statements?

If you do, then this tip is going to kill it. If you do not, good on you, please contact me, I am keen to work on such projects, haha, just joking.

The fold feature works quite well in such situation that I can quickly fold everything or any particular level of code to see the whole picture of this giant javascript file.

I am going to show one example with better code structure here.

For Mac:
unfold all: cmd+k, cmd+j
fold all: cmd+k,cmd+0
fold level 1: cmd+k, cmd+1
fold level 2: cmd+k, cmd+2
fold level n: cmd+k, cmd+n

For Windows:
unfold all: ctrl+k, ctrl+j
fold all: ctrl+k,ctrl+0
fold level 1: ctrl+k, ctrl+1
fold level 2: ctrl+k, ctrl+2
fold level n: ctrl+k, ctrl+n

More in my latest blog post:
https://medium.com/@qjli/daily-dev-tips-81-visual- studio -code-shortcuts-to-fold-unfold-nested-code-blocks-effortlessly-d88b9d898ec9

Feel free to leave me any comments, concerns or questions.

Comments

MI Media says:

nice video pls see our video

Write a comment

*

×