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.
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:
Since I am using Visual studio Community 2017 edition it shown me to install extension for it as shown in above figure 3.
Once clicked on “Install” button it will start installing as shown below figure 4.
On successful installation, “Install Complete” dialog will appear as shown in below figure 5.
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
Once I hit the tab on the “region” IntelliSense it adds the region snippet as
// #region <name of my region>
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.