Folding comments in VSCode

I moved over from Atom belatedly but find that the shortcuts for folding all or folding block comments are not working with Julia block comments. Atom also used to fold a series of single line comments, which I found helpful.

Is there a way to implement both of these in VScode?

4 Likes

Not exactly what you’re asking, but I found out recently, that you can put the following comments around an (almost) arbitrary part of code to make it a foldable region in VSCode:

#region >>ARBITRARY TEXT<<
...
code
...
#endregion

Almost arbitrary, because the defined region must not intersect another already foldable block (which of course makes sense).

5 Likes

Something which didn’t work for me: # region >>ARBITRARY TEST<< and # endregion (with the spaces after #).
Just in case anyone has the same issues as me (@_bernhard 's answer without space works)

1 Like