code folding

Inquie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 14 14:48:37 PDT 2017


On Tuesday, 14 March 2017 at 20:56:02 UTC, Ali Çehreli wrote:
> On 03/13/2017 10:29 AM, Inquie wrote:
>> Does D have any nice way to specify a block for cold folding? 
>> I have a
>> very large set of structs and I'd like to be able to code fold 
>> them all
>> at once and together.
>>
>> I have been using
>>
>> static if(true)
>> {
>>     ... junk
>> }
>>
>> but the static if is uninformative since that is the only line 
>> that is
>> shown when folded. A comment helps but still kinda ugly.
>>
>> C# has #regions and hopefully D has something as useful.
>>
>
> There is version:
>
> version (all) {
>     // ...
> }
>
> You can define your own version identifiers as well:
>
> version = some_descriptive_name;
>
> version (some_descriptive_name) {
>     // ...
> }
>
> Ali

Oh, that might be better. I thought of versions but I didn't want 
to have to define anything... didn't know about all.




More information about the Digitalmars-d-learn mailing list