Use markers such as //#region and //#endregion to mark folding regions
@mbeckenbach can you provide more information of what you are looking for? I am not familiar with //#region support.
Also, is this VS Code specific or is this a feature request for TypeScript? This may be better in TypeScript.
The full visual studio uses comments to mark code blocks as collapsable in all languages. Depending on the language, the syntax is slightly different as the comment syntax is different.
Hard to explain, but web essentials has a nice screenshot of regions in the javascript area: http://vswebessentials.com/features/javascript
Regions should exist for all languages. The comment syntax is different but the result schould be the same.
I think, @mbeckenbach are talking about the #region, current present on c# syntax of Visual Studio. Currently, on C#, #region name_region is used to tell where code will start folding and #endregion tells where code will stop folding.
I'm really missing this feature on VS Code as well, all my code have regions for better code reading and on VSCode I can't fold my regions.
e.g.
void MyDummyMethod()
{
int a = 1 + 1;
}
void MyDummyMethod2()
{
int b = 1 + 1;
}
In the sample above, the entire region block should fold and "region_sample" should be the label on folding.
yes, that's what i'm talking about. i'm really missing that feature in other languages like for example ts
This issue was moved to Microsoft/TypeScript#11073
@waderyan Not trying to step on any toes here... but just curious why this issue would be moved to Typescript, isn't regions purely aesthetic? That seems like something the Editor should be handling not the language.
As others have mentioned this is great for large code bases, obviously its better when you can split things across multiple files but that's not always the case in large projects without adding even more unnecessary complexity.
@awdogsgo2heaven thank you for your comment. You may be correct and I have been meaning to come back and reopen this issue on our end to gather more feedback from VS Code users.
@isidorn I believe this issue is more general than TypeScript. This is a possibility for a feature request for any language. We see this in other editors (for example, this is what WebStorm does).
Possibly this falls under code folding and should be assigned to @aeschli?
Please advise.
FYI @aeschli @alexandrudima
Would like to have this support too.
Note that the way of WebStorm #region
is different than in Visual Studio for C#, so I don't know if it should or can be done in one shot for all languages.
In WebStorm, you specify the region (for JavaScript) as follow:
// region Some comment
... code
// endregion
Notice that it does not have #
before region
and endregion
.
when folded, it looks like this:
It would be great to match WebStorm syntax for JS/TS as my team use it instead of VSCode (I keep persuade them to change. 🌷 ), but that's my personal need / preference.
I use regions heavily and I have // #region XXX
and // #endregion
all over my JavaScript code which I mainly edit with Visual Studio 2015 Pro.
Here's what Visual Studio 2015 does with them:
(Above: Image of uncollapsed // #region Constants
and collapsed regions: Main, Data Access, File I/O)
My team absolutely needs this feature for large files and we can't use VSCode as our main editor without it.
I would love to see this feature in VS Code as well.
In my case, for PowerShell scripts.
...code...
Thank you!
Bump
As a C# developer, region/endregion is very general use on wrap reference section. Like below
Please teach me how to do on VSCode. If the feature not implement, please consider it seriously.
The request to allow language aware strategies is #3422
Could this be handled by an extension?
@cossio Unforturtunatly not yet.
@aeschli this does not appear to be a specifically language aware strategy. It seems to be for creating bounded regions in the editor in general. It may be beneficial to create such regions regardless of the actual underlying language, provided it appears within a comment. Thus
// region
// endregion
/* region
/* endregion
and so on. Even though the initial request was Typescript, it should not be limited there and would be better suited as a language agnostic feature.
It should not exist in any language because this leads to bad code structure. You shouldn't encapsulate your code to comments instead of methods/classes/namespaces for better readability.
@AuthorProxy This has nothing to do with code, only with the way it is presented in an editor, allowing you to _visually_ denote regions and fold them up. So if, for example you are working in C#, and you put all public methods after class properties and your private methods are at the bottom, you can simply put
// region public methods
a couple lines above the first public method and
// endregion
a few lines after the ending of the last, and fold them all to easily skip over them while scrolling. It does not affect the code at all.
@stevepentland Why should everybody see this comments in the source code? It should be clean and self-documented, with comments only there where they should be. Probably editor can provide functionality for a block collapsing or selection collapsing, but it definitely should not make any changes to the source code. First, you should avoid comments, and make code structure and readability better. Second respect people who do not use VsCode or Visual Studio, I don't think anybody like garbage at the source code which gives you zero profit.
For such things that you say about collapsing public or private or any other shit like this, there are tools like stylecop, resharper, eslint and many others for each language, which can sort methods and force you to put it on right place, based on method visibility, alphabet or the arrangement of stars in the sky.
@AuthorProxy Thanks so much for your programming lesson. I guess I've been so wrong all these years. The fact that Visual Studio has offered this for a very long time and that pretty much every JetBrains product also does, the whole world seems to be in horrible shape. I'll be sure in the future to ask you before I write any code, just to make sure it measures up to what you think code should be. Don't forget to let Microsoft know how wrong they've always been and I'll be sure to refer everyone to your standards in the future.
@stevepentland I like how you hide behind "everybody" in our conversation and how you make idol from Microsoft. I don't want teach you or continue the discussion because it seems your arguments finished.
@AuthorProxy Hey I'm not the one who decided to freely offer a programming lesson to someone I didn't know on the internet. To be honest, I don't care how you write code, and the way anyone else does isn't my business either.
However, both professionally and privately I have found regions to be a useful feature in many code bases. And obviously others do feel the same as I'm certainly not the one who came up with the concept. Thus, someone opened an issue asking for a feature many of us are already used to. You were the one who decided to tell us how wrong we all are for how we do things.
Nothing new on work with regions ? Btw i love VS Code keep up the good work.
It seems this feature is still not supported.
I use the region/endregion feature on real-world production code a great deal and miss it for my JS code in VS Code. I'd love to see it added or for VSCode to be extensible enough that a 3rd party extension could add it.
This feature would really help us organize our code for readability and quicker editing!
I think it is already implemented but in a weird way cause you have to tab the content in then it will show the folding '-' button on the gutter, but if you format the doc it will remove those tabs out thus render this method broken
@viqofirdaus I believe that is only for C#
I really want this feature on Visual Studio Code.
Any news on this?
would be great dude !
Why was this closed?
because does not exist #region at typescript man.
@VictorAnquino that is true. #region is a C# thing (and maybe a few others?). The idea here remains the same though. The request is that there is a way to signify to the editor that we're logically grouping sections of code and would like them to be easily fold-able. One of the best implementations I have seen of this is in FlashDevelop. Their editor continues to respect folding of { and } in comments. This allows you to compose something like:
//{ Members
public x:number = 0;
public y:number = 0;
public width:number = 0;
public height:number = 0;
//}
The region above would fold/collapse down to Members...
When it comes to C#, (nearly) everyone is using Visual Studio, and so you can expect that seeing #region in a .cs file will not annoy (almost) anyone.
However for VS Code, people will quite often being opening files that someone else has created or edited in another editor. For those people, putting in VS Code-specific constructs will almost certainly be annoying.
As much as I love #region in Visual Studio, I can't really think of a way of including it in VS Code in a clean way that continues to support the rich ecosystem.
Probably, the only way to get such a feature IS to include it as a language feature in TypeScript, in which case it could be supported by all TypeScript-capable editors.
It is an editor feature. VS and WebStorm both support it, but in different syntax.
For vscode, it would be best to make it configurable so that the team can use one syntax that works for multiple editors.
It seems that in Jetbrains editors, the file content is parsed, and when the region word is seen in a comment, the next following endregion is then matched with it and the foldable region is created. It is not based on the language itself, but that it appears in whatever makes a comment (whether that be //, /**, #, and so on) in that language. Since they are standard comments for the language in question, they are no more intrusive than comments themselves would be. Jetbrains example is the best I can come up with in this case as they support many different languages in their editors. In these editors, regions can also be named so that a folded region will display the given name (for example // region private will show private when folded), and the regions themselves are nestable.
as @viqofirdaus mentioned, you just need to tab in code in order to do regions.
//Variables
var variable1 = 1;
var variable2 = 2;
var variable3 = 3;
//Methods
function someMethod(){}
function someOtherMethod(){}
these will have a collapse icon in the gutter and will only show the comments when collapsed.
Above shows it being used in JavaScript but it also works for html (I us vs community for C# as I code on windows systems, so I didn't test it for .NET based languages yet). all you need to do is make the collapsible region more indented.
I do also agree with @AuthorProxy in that '#regions' pollute the code and might introduce issues when compiling with different IDE's. Never had thought of it being an issue until I read this thread. I think that how the collapsing is incorporated now is a brilliant idea as it helps vs-code be language agnostic and not have to remove IDE specific syntax when compiling which could be an issue for others who prefer other IDE's like vim or atom.
I think the online documentation needs to explain this a little more as it only showed a method body being collapsed as an example.
I think a good plug in would be able to parse files for common region syntax and then change things such as '#regions' into //regionName and further indent the region itself
If you feel it pollutes the code then simply don't use the directive. Make it something you can enable/disable for those who don't want to use it. Given that VS Code derives its name from 'Visual Studio', which implements this feature, and other IDE's with code folding implement this feature, I fail to understand what all the feet dragging is about. Implement it already.
@ChessMess I agree that a toggle feature would be very important for those who are very familiar with the '#region' method and would wish to use that in their code. I wonder how hard the implementation would be and if the benefits would out way the effort. Is anyone familiar with the code folding implementation in vs-code and if you are could you comment on the issue of a toggle feature or allowing both features to work in sync?
I always missed #region since I left Visual Studio. Browsing the code through regions was pretty handy. I don't understand the complexity to implement it or to create an extension. I Hope it will see the light someday.
Pleeeeeease 😃
I am thinking about how it can be implemented and I feel as if using the languages version of a comment with a unique phrase would be ideal as it would easily let compilers work with the code without having to remove any strange '#regions' out of it. For instance javascript wouldn't work with the line starting with a '#' and would require the extension or ide to remove it before running the application which would be tying that file or script to the IDE itself which I feel is not the right way to do it. Ideally something such as
// code-region Methods
function doSomething(){}
function parseThis(){}
// code-region-end
and
<!--code-region Form-->
<div>
<input/>
<input/>
<button/>
</div>
<!--code-region-end-->
but maybe not "code-region" exactly. Any thoughts on this guys/gals?
@TLBSoftware agreed. It should consider comment notation used by each language but look for "region {name}" and "regionend" to create a region. If I'm not mistaken, we could even do a region search within Visual Studio. That is very useful.
@TLBSoftware this is almost exactly how jetbrains does it their's looks like
<Language comment notation> <region> <region name>
...
<Language comment notation> endregion
So for js and php for example
// region Public Methods
...
// endregion
In this way minifiers can strip out the regions the same way they do comments
VS (and therefore JetBrains) did it that way because they needed/decided to
fit to their existing compiler directives syntax.
VS Code has no such constraint, and I agree that using comments is good
because it's language and editor portable, so how's this for a wacky idea:
//+
...
//-
It's function is bit more guessable, I reckon, and is less "Microsofty" to
those that are so inclined. Plus I have already typed r-e-g-i-o-n as many
times in my life as I'd like to.
On 3 Aug. 2017 9:34 pm, "Rhonun" notifications@github.com wrote:
@TLBSoftware https://github.com/tlbsoftware this is almost exactly how
jetbrains does it there's looks like
...
endregion So for js and php for example
// region Public Methods
...
// endregion
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/12146#issuecomment-319943985,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABjIdZ5xFe8M9kDsDPWib75s1i1S2aDLks5sUbBSgaJpZM4J-5zO
.
Any news on this? I can't use the tabbed version, otherwise StandardJS will slap me in the face.
I think I'd opt for something that is already being used by other editors over inventing something new.
// region My Region Name
...
// endregion
I've also seen this
//{ My Region Name
...
//}
region support would be very nice
@TLBSoftware has a good temporary solution with indentation and comments
//Variables
var variable1 = 1;
var variable2 = 2;
var variable3 = 3;
//Methods
function someMethod(){}
function someOtherMethod(){}
But proper region support like the full Visual Studio IDE has should be the final goal
#region MyRegion
var variable1 = 1;
#endregion
An add on for Visual Studio IDE https://marketplace.visualstudio.com/items?itemName=MadsKristensen.JavaScriptRegions
Using this issue to collect votes for region folding.
How do we vote? I think many people here have already voiced their interest.
interesting extension that does part of what #region functionality should do: bookmarks
maybe it can evolve to what we want here?
Hello,
I was thinking about vscode working with a separate json file that holds peoples regions to be language independent (Regions.json):
files: {
name: "Main.cs", regions: {
{0, 6, "usings"}, {10, 15, "private vars"}
},
name: "Lib.cs", regions: {
{1, 10, "constructor"}
}
The editor would manage tracking and persisting the info and the developer be able to toggle its visibility through settings. Thank you. Good day.
Hello,
One alternative is to put effort towards a universal block tagging mechanism. You can write one regex that identifies a start and another to identify an end. You can specify if nesting is allowed. I could for example go and make this:
settings.region = {start: "/^[ ]*[#]region[ ](\\S)$/", end : "/^[ ]*[#]endregion$/", nest: "true", files: "*.cs", languages: "csharp" }
Now if we assume the first ($1 not $0) match group is the region label, it is not too bad for this. vscode can be aware of this filtered view and possibly load any number of these from extensions. Thank you. Good day.
@cossio To vote, add a 👍 to the issue description
Add 👍 to the OP:
I have code files full of #region tags because it works on visual studio CE on my pc. It doesn't work on Visual studio or visual studio code on my mac at all. I use it to manage my code, and it doesn't work at all. Please get this fix through as fast a possible.
I (and many others) use this for PowerShell. I would love to see this supported in VSCode.
I have to edit code on multiple editors, so it would make sense that VSCode used the same convention for region comments:
... stuff that can be folded away
So, in PowerShell:
````
function x{ ...etc etc
````
Using other syntax (e.g. //+) is not a bad idea, but either (a) support both, or (b) make it configurable. Otherwise I'd have to change all my scripts to use them in VSCode and region support would then be broken if I needed to edit in another editor.
Thanks.
I don't think it's necessary feature. I also don't think it should be even considered.
IMO using regions is a way (quite nice shortcut) to get in trouble. If you have to use regions it means your code is not clean. This is NOT language-specific feature, it's only used by VS and its usage is not directly specified. Please keep your code clean instead of using ugly workarounds.
@Melmoth-the-Wanderer
Hello,
I would agree that it is not necessary. Are you against folding code at all? Vscode already has folding based on indentation. Structural artifacts are not about whether your code is clean. Some languages have limits about how you can visually layout code and regions can improve it.
One point is about how to introduce something that is editor only or to make it so an extension can scan and give the user a choice in how they want portions of code to be presented. Given that there is also an issue for language aware folding, there seems to be overlap about whether this is cherry picking one notion of that broader endeavor. If you are particularly concerned about what people put into there code, then the language designers are a better group to mention your concern for some of your points.
I think Eclipse and Idea have awareness of regions either directly or through plugins. Thank you. Good day.
@Melmoth-the-Wanderer - thanks for your thoughts. I'm glad you personally don't need region support and therefore don't miss the feature. I will resist the urge to get involved in a conversation about code style and whether yours is superior to mine (although I will note that it almost certainly is). I will also note that region folding can be useful for more than just hiding ugliness.
It's clear that folding is considered desirable by a number of people (not just me). Can you bear in mind that if you find the facility unnecessary you, naturally, do not need to use it.
Best Regards.
Dear @ChrisWarwick , dear @pr-yemibedu,
Thanks for paying me attention to my way of writing, which might be considering as "hate", but it's not (hopefully). What I'm saying is - I don't like the idea. My thought are based on my experience (and other developer code I'm working on), and they are base for my private opinion. I just consider this 'folding' feature to be more harmful than good. I might be wrong, but currently this is how I feel, therefore I'd like to add my worries to the discussion.
It's up to product owner to decide whether to implement this feature - instead of implementing other useful stuff - or not. Time and resources are always a problem here, it's never good idea to blindly add more and more features, "because we can" ;) VS is good a example here - it's overwhelming and heavy tool - that's why I'm using VS Code instead.
Also, I definitely agree that 'pluginizing' features is a good way of letting user to decide if they want to add (and use) certain features or not. I simply don't like to idea to keep everything in the core :)
@Melmoth-the-Wanderer
Lite is good. Supporting this with a plug-in is fine for me --- Providing VSCode provides sufficient context to the plug-in to enable it to work. I claim ignorance on this point, but have to imagine that if it was currently possible to create a region folding plug-in one would exist by now...
@ChrisWarwick Agreed. If it was possible in the first place an extension should have been created by now. Or people do not care about it enough and focused on more useful extensions. Anyhow, for me, it is not a need, I can live without it although I find it very neat. I have a vague memory that I read somewhere that VSCode can't handle regions as it is, that is why nothing has been created so far, but I can be mistaken.
Hello,
Vscode does the hooks for folding as part of core (for indentation). It needs to establish a user facing api that an extension can tell when to begin and end a fold. This will also enable notions for nesting of folds, what the current fold level is, what is a valid marker, what is the signaling glyphs to the user ("+/-" or a label) and if there is support for mixing multiple kinds of regions (comment, keyword, or structure).
I appreciate all feedback and welcome everyone's point of view. I include my two cents as a way to give developers a chance to consider how something can be implemented. I also think about those who may not know many other languages and to not consider there to be only one reason why something is being considered.
I was actually not considering your feelings in my previous reply. I was just adding information to the context you provided. I would not be able to tell whether you were hating or not. That is why I asked about folding in general and mentioned the idea of limitations of language layout. Thank you. Good day.
Here is a documented example of language-agnostic support, i.e. #region Foo
or //region Bar
depending on language comment format, as well as less frequently used <editor-fold>
style. Worth mentioning that it works for both //region
and // region
as comment padding is usually a linting rule.
Super happy to see this issue on the iteration plan with targeted release for Oct 2017!
Folding now supports region markers. Markers are defined by the language in the language configuration. The following languages currently have markers defined:
//#region
and //#endregion
and //region
and //endregion
#region
and #endregion
#pragma region
and #pragma endregion
#region
and #endregion
#Region
and #End Region
Let me know about common region markers in other languages.
Making the region markers configurable in the settings might come at a later time.
Fantastic, thanks a lot Martin!
Amazing! :D hoping to see php on the list soon!
Hello,
@aeschli where in the source code was this added?
Would it make sense to add this for F# in the style defined in F# Outlining extension for Visual Studio?
It is mentioned here Regions and Navigation by @tpetricek in an article. It would be the //#region
and //#endregion
form. Thank you. Good day.
@Fenweldryn What region patterns are common in PHP?
@pr-yemibedu I added the suggested region markers to fsharp
@aeschli For php using Javascript pattern is fine: //#region
Hello,
There is also something to be said to follow other existing tooling that would make it easier on people. Phpstorm uses //region
as described here Using Folding Comments. including a comparison with other editors. Just to minimize possible disparity. Thank you. Good day.
Hello,
@aeschli is there a way to have a fallback folding region. {single-line-comment-leader}<editor-fold desc="Description">
like //<editor-fold desc="Code">
that is used with netbeans and jetbrains products? Then when something specific is needed, it can be added with precedence ahead of the fallback. That is described in Folding Regions for JetBrains and for Code Folds Netbeans. Thank you. Good day.
Hi @aeschli please can you confirm if the content within the #region and #endregion tags has to be indented for the collapsed visual decoration to appear, as is currently in vscode 16.1?
I say this because it would be very handy to use #region to hide the useful, but ugly PowerShell here-string syntax where the @" or @" has to be on the first column of a new line :(
Support for CSS/SASS/LESS would also be very nice.
Pattern is /*#region Description*/
and /*#endregion*/
@Ben-Shirley Content inside #region and #endregion does not need to be indented: It can have any indentation.
When will this show up in the Insiders build? It doesn't seem to be working for me here:
Judging from the date in that screenshot there hasn't been an Insiders update in a few days, maybe that explains it?
@daviwil Yes, unfortunately still no insiders updates on Mac and Windows. Use Linux or see #34978 for download links.
Hello,
@aeschli I have some nice updates to the fsharp language folding regular expression. Should I send a pull request or do you need to apply the code yourself? This will enable the following:
This style will allow languages like CSS to have fold support (it only has block comments).
I already tried with my own editor and it all does the right thing. This would be helpful to give freedom of choice to the developer and let VSCode lead by example. Thank you. Good day.
@pr-yemibedu I'm happy to take a PR. But I'd like to limit us to established folding markers, and not come up with new variants, however useful they might be.
At some point we will can add user configurable markers.
Hello,
That sounds fair enough. I will qualify any future submissions of this kind with a link to at least one other generally accepted popular editor. Probably looking at tmLanguage files would be a good reference point. Thank you. Good day.
Could vscode support #region and #endregion in PHP ?
( # is also PHP comment )
http://php.net/manual/en/language.basic-syntax.comments.php
@DarkNami I'm happy to add it if this is already an established marker in PHP. Please file a new issue or even PR.
What about Python? A simple #region
and #endregion
would be useful. Right now you can only fold like that if you indent code between the two region comments, but that leads to wrong indentation errors.
This new feature doesn't seem to work in a HTML file.
eg (file: my-app.html):
...
<script>
//region
..... some stuff
//endregion
</script>
That would be very usefull.
Hello,
@yveslange the region handling it is not a global feature. So the javascript regions would need to be included in the htnl language configuration. I am sure many would argue if you start to use regions, to pull that code out into a dedicated file. The you will get the support you expect. Thank you. Good day.
Hello,
@KillyMXI honestly you probably actually want language aware context folding instead of this artificial editor folding. CSS only has block comments, so be careful with your sets of open and close comments. Anyone can manually edit their CSS lang config file:
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\css\language-configuration.json
and add an acceptable folding section.
"folding": {
"markers": {
"start": "^\\s*\\/[*]\\s?#region\\s*(.*)\\s*[*]\\/$",
"end": "^\\s*\\/[*]\\s?#endregion\\s*(.*)\\s*[*]\\/$"
}
}
This is something that would probably be lost when the program updates itself, but if you want it anyway, that would probably be a possibilty. I always make a copy of the file before I make changes, just in case. Thank you. Good day.
We want both language aware context folding and artificial region folding for every language. The Ace editor does this for all C style languages (including CSS); it also works for the SqlServer language.
https://github.com/ajaxorg/ace/wiki/Non-Standard-Code-Folding
Hello,
@sevin7676 I agree that a lot of people do want both. I looked at ACE too before and found it had some nice folding options. My prior post was because MXI was asking about a feature in a different issue that seemed better suited here.
So my first sentence is actually out of context here as I started writing it. The rest of my post and example are actually in support of the idea that users should have choice. The code snippet I shared can be hacked into any 1.17.1 editor where they want some non official support for existing code. Thank you. Good day.
Hello. Thanks for answers, @pr-yemibedu
I missed this issue because it has closed status.
I upvoted https://github.com/Microsoft/vscode/issues/12146#issuecomment-332472259 above, with only note that I'd like it to support arbitrary number of spaces around #region
keywords and maybe optional description repeated after #endregion
, so it will be easier to read in other code editors without region folding.
I'm not interested in editor hacking. I'd like to see this as an officially supported feature that I can refer to when formatting files for a project accessed by multiple developers.
There should be an option to set initial fold state for specific regions.
#region imports folded
// code folded by default
#endregion
#region logic
// code not folded by default
#endregion
````
you can make it even more fancy with region pragmas taking json objects as props
```javascript
#region imports {folded=true, bgColor:'red', fontSize:'8pt'}
@aeschli can we have the folding markers be arrays instead of just a single string? The logic would match start and end markers pair wise until the shortest list is exhausted.
indentRanges.ts 200 can have patterns (an Array) instead of pattern (a String) and just loop over the smaller of the two lists.
let minMarker = markers.start.length < markers.end.length ? markers.start.length : markers.end.length;
for (let currentMarker = 0; currentMarker < minMarker; currentMarker++){
let currentPattern = new RegExp(`(${markers.start[currentMarker].source})|(?:${markers.end[currentMarker].source})`);
patterns.push(currentPattern);
}
indentRanges.ts 220 can check for list length > 0 with an outer if and then on an inner for loop over each pattern, do all the existing logic you have today inside.
if(patterns.length >0){
for(let pattern of patterns){ do existing logic }
}
And that would all work (including an update to the schema) with below as an example.
"folding": {
"markers": {
"start": ["^\\s*#Region\\b", "^\\s*Region\\b"],
"end": ["^\\s*#End Region\\b", "^\\s*End Region\\b"]
}
}
This would promote not having mixed start and end markers.
Most helpful comment
I think, @mbeckenbach are talking about the #region, current present on c# syntax of Visual Studio. Currently, on C#, #region name_region is used to tell where code will start folding and #endregion tells where code will stop folding.
I'm really missing this feature on VS Code as well, all my code have regions for better code reading and on VSCode I can't fold my regions.
e.g.
region region_sample
void MyDummyMethod()
{
int a = 1 + 1;
}
void MyDummyMethod2()
{
int b = 1 + 1;
}
endregion
In the sample above, the entire region block should fold and "region_sample" should be the label on folding.