Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add region in java script file, visual studio

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

like image 427
Sharad Avatar asked Oct 13 '17 08:10

Sharad


People also ask

How do you define a region in JavaScript?

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.

What is region in Visual Studio?

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.


1 Answers

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.

like image 86
Michele Federici Avatar answered Oct 14 '22 07:10

Michele Federici