Be able to set regions in the Arduino Code

Hello,

I am used to do some programming in VB .NET. In VB .NET there is the possibility to place a piece of code into a region. This region of code can be fold up (minimized). The advantage of this is you can make your arduino look more clear.

Region "Serial Communication"

void setup() { Serial.begin(9600); }

void loop() { Serial.println("Hello World!"); }

End Region

http://www.vbdotnetheaven.com/UploadFile/vbdev123/region08082009093337AM/region.aspx

It would be a cool feature in the arduino code.

Cheers :)

That would be quite cool and could be a new part of the //quoted out bits...

If some of the developers read this then I think it would be a good idea to put in arduino 17 :D

Great idea,

Regards,

Mowcius

This is already kind of handled by the tabs concept...if your program is too long to get a handle on it without collapsing sections of it, then you should probably split it up into tabs.

Yes, I suppose it is… I haven’t really had a play around with the tabs so cannot comment on how that works…

What is the limit of how you can split it up? Can you just split things up into ‘20 or so lines of code’ sections?

It’s not quite as simple as that though is it? Hidden sections of code would still be good…

Mowcius

For example in VB.Net it is possible to add a module or class (separate file) to a project. I think this is almost the same as adding a tad to the Arduino IDE.

The "Region" feature would be a great tool within a tab to minimize code you don't use at that moment.

Wouldnt it be better to introduce code folding? This allows you to fold or hide any defined area in the code such as a class, function or anything that is clearly bounded by brackets over several lines. Most of the "big" ide's do this.

Gordon

Hi Gordon,

I think this would also be a great addition, but it would also be great to fold a defined range of lines. For example all the code that includes Servo Control could be in a separate region that can be folded. The functions ect.. can also be folded within this region.

This is the way "Big" IDE's work :)

Cheers

the compiler will freak out when it sees these unsupported preprocessor statements

the IDE could be changed to strip them out on compile, but that still breaks code portability

i suggest this work around

//region region name

//endregion

and change the IDE to fold that instead

or even better

#ifndef region_regionname

#endif //endregion

this also has the added advantage of activating or deactivating a region of code by using #define

Your suggestion sounds great. I really would like to see this feature being implemented.

/me