Regions in TypeScript

JavascriptVisual Studio-2012TypescriptRegions

Javascript Problem Overview


In my JavaScript (.js) files, I use a Visual Studio 2012 plugin for regions (here) like this:

//#region "My Region"

//Code here

//#endregion "My Region"

I would also like to have regions in TypeScript (.ts) files as well. Is this a possibility right now?

Javascript Solutions


Solution 1 - Javascript

You can download Web Essentials 2012, it lets you use regions in TypeScript.

If you use, Visual Studio 2015, here is the freshest link. Web Essentials 2015.3

Solution 2 - Javascript

Visual Studio 2017 also has support for regions here.

Support via Web Essentials for older versions may be found here.

Solution 3 - Javascript

You can follow the TypeScript GitHub issue here

TypeScript Regions #11073

Still no ETA on when this will be implemented, currently awaiting more feedback.

Solution 4 - Javascript

To request a new feature for TypeScript, you should start a discussion on Codeplex.

There are lots of opinions about regions being a bad thing - perhaps they are telling you that you have too much in a single file. TypeScript has a great way to load modules from many different files and it may be better to use that to separate your concerns.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGaffView Question on Stackoverflow
Solution 1 - JavascriptunjukenView Answer on Stackoverflow
Solution 2 - JavascriptHighdownView Answer on Stackoverflow
Solution 3 - JavascriptwoneaView Answer on Stackoverflow
Solution 4 - JavascriptFentonView Answer on Stackoverflow