Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Region code folding for javascript

I was looking for a way to fold my JavaScript code in Atom using something like C# regions:

#region: hey
//some cool code here
#endregion

I couldn't find any package like this. I know that you can press CTRL + Alt + F and fold whatever code is selected. But I want to have named regions.

So the real question is, does anybody know how can I do this in Atom?

Thanks!

like image 619
NaN Avatar asked Mar 25 '16 22:03

NaN


1 Answers

I was looking for the same and I found the package custom-folds.

By default, it will fold the code between // <editor-fold> and // </editor-fold> but you can customize it to work as // region and // endregion (notice the space between // and region. The package is in active development so it will soon support #region. See the bug https://github.com/bsegraves/custom-folds/issues/3

like image 139
david_g Avatar answered Sep 24 '22 04:09

david_g