code folding

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 13 14:42:51 PDT 2017


On Monday, 13 March 2017 at 19:51:59 UTC, Inquie wrote:

> This is wrong. It is a language feature.
>
> #region lets you specify a block of code that you can expand or 
> collapse when using the outlining feature of the Visual Studio 
> Code Editor. In longer code files, it is convenient to be able 
> to collapse or hide one or more regions so that you can focus 
> on the part of the file that you are currently working on. The 
> following example shows how to define a region:
>
> Obviously it is useful for the IDE, but if it was not a 
> language feature then the code would not compile(as it's not a 
> comment).

 From my understanding of the feature, it does the same as

// region

... code to be folded ...

// endregion

An IDE can then read those comments and allow code folding. It 
might meet some definition of a language feature, but it is 
nothing more than a comment.

> I use visual studio and if it was an IDE feature then I could 
> insert #regions in it and it would compile. This would, of 
> course, break anyone else code that doesn't use an IDE that 
> supports it... hence it has to be a language feature(or some 
> type of meta comment thing, which it is not in this case).

I don't understand how it would break your code.



More information about the Digitalmars-d-learn mailing list