TypeScript: Adding regions in Visual Studio 2017

In this article Iβll share small detail how to include regions when we work in TypeScript in Visual Studio code.
Background: I was working with one of my SharePoint Framework Extension (SPFX) client side web part. I am using Visual Studio 2017. Β While working in development environment there is lots of commented code since we are still developing and testing.
By default, I couldnβt add region as we do in Visual studio 2017 for C# programming. I want all my commented Code in one region in my .ts file. so that it wonβt be visible all the time.
Since I am new to TypeScript I was not sure how to add regions, so googlingβ¦ and then found that in Visual Studio marketplace there is tool available called βJavaScript Regionsβ. Β This tool is freely available and for Visual Studio 2017.
Installing the “JavaScript Regions” :
Log in to Visual Studio Marketplace https://marketplace.visualstudio.com/, in the search box search for βJavaScriptβ as shown in below figure 1

Figure 1: Visual Studio Marketplace – JavaScript Regions search
Or we can directly also go with the URL – https://marketplace.visualstudio.com/items?itemName=MadsKristensen.JavaScriptRegions#overview
Once we are on the above URL, we can download the βJavaScript Regionsβ and it will download βJavaScript Regions v1.1.3βΒ Microsoft Visual Studio ExtensionΒ (.vsix) file.
Double click on the downloaded file it will ask for products for which we want to install this extension as shown in below figure 2:

Figure 2:Visual Studio Marketplace – Downloading JavaScript Regions tool
Since I am using Visual studio Community 2017 edition it shown me to install extension for it as shown in above figure 3.

Figure 3: Visual Studio Marketplace – Installing JavaScript Regions
Once clicked on βInstallβ button it will start installing as shown below figure 4.

Figure 4: VSIX Installer – Installing JavaScript Regions
On successful installation, βInstall Completeβ dialog will appear as shown in below figure 5.

Figure 5: VSIX installer – Successfully installation of ‘JavaScript Regions’ tool
Restarted the visual studio and it worked like charm. I Visual studio in my typescript file a βregionβ snippet is coming in IntelliSense as shown in below figure 6

Figure 6: Visual Studio – TypeScript file – region snippet in IntelliSense
Once I hit the tab on the βregionβ IntelliSense it adds the region snippet as
// #region <name of my region>
// #endregion
Finally, happily I added my commented code in region πΒ This is very good tool to simply adding regions in my TypeScript file in Visual Studio so shared.
Thanks for reading π
Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.
Stay tuned on Knowledge-Junction, will come up with more such articles.
good