Search code examples
javascriptangularjs

How to add region in javascript file, visual studio


How to add region to collapse and expand code in javascript. If any body knows solution, it will be great. thanks in advance.


Solution

  • It depends only on the IDE.

    vscode, for example, added support for code regions in september 2017

    https://code.visualstudio.com/updates/v1_17#_folding-regions

    For javascript:

    //#region
    
    code
    
    //#endregion
    

    or

    //region
    
    and
    
    //endregion
    

    The same syntax could work also in different IDEs.