How to add region to collapse and expand code in java script. If any body knows solution, it will be great. thanks in advance.
By marking a section of code (regardless of any logical blocks) and hitting CTRL + M + H you'll define the selection as a region which is collapsible and expandable.
Use the #Region directive to specify a block of code to expand or collapse when using the outlining feature of Visual Studio IDE. You can place, or nest, regions within other regions to group similar regions together.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With