IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Parker on January 06, 2006, 10:04:00 PM

Title: #region...#endregion
Post by: Parker on January 06, 2006, 10:04:00 PM
I think this has been mentioned before, but I really wanted it to appear in the language. The #region and #endregion keywords work just like line comments, but they signal to the IDE that you are beginning a fold region, much like the { ... }.
In C# you can use them like this:
#region Controls in my window
Button1.Create(...);
...
#endregion


I just feel that it makes code a lot easier to see when you can define your own regions of code that you can collapse and expand. And since we already have the scintilla editor, I didn't think it would be very hard to implement.

Thanks
Title: Re: #region...#endregion
Post by: Ionic Wind Support Team on January 06, 2006, 10:21:46 PM
Scintilla impliments it's own code folding. 

In order to do that I would need to create fake keywords for the parser to ignore, since it would try and process your #region as a command.
Title: Re: #region...#endregion
Post by: Parker on January 06, 2006, 10:33:52 PM
Is it something that may be implemented though? Or is it too weird to add? Maybe if using that syntax doesn't work, it can appear as a comment.
//#region Some region
statements;
//#endregion


It's just for convienence and I'd like to see it added eventually, but if it can't be, I guess it just can't.
Title: Re: #region...#endregion
Post by: Ionic Wind Support Team on January 06, 2006, 10:39:14 PM
I will look into the Scintilla implementation to see if it can be adapted.
Title: Re: #region...#endregion
Post by: Parker on January 06, 2006, 11:33:46 PM
Thanks so much! I hope it all goes well.
Title: Re: #region...#endregion
Post by: Zen on January 07, 2006, 04:45:45 AM
If im right in understanding what these #regions are then you could use this as your ToDo feature Parker. In that case i also think it would be a good idea for when you have a lot of documentation in your programs, you can simply just fold it away until needed.

Lewis
Title: Re: #region...#endregion
Post by: Parker on January 07, 2006, 11:36:14 AM
The #region is just for folding away sections of code. For example, if you use C#, you'll have a
#region Windows Forms Designer generated code
Form1.AddButton(...);
...
#endregion

so then you don't have to worry about its code.

The TODO: thing is another issue, since you have to be able to search through all the files in your project for a //TODO: comment. Which I can do currently with the find in files, I just like the todo list and easyness of that, it's not any big deal at all though.
Title: Re: #region...#endregion
Post by: SMartin on February 18, 2007, 10:39:25 PM
I know this topic is a year old and this has probably been discussed elsewhere but....

//{ <any region name you want>

(bunch-0-code)

//} <end of any region name>

works is the editor and allows you to fold a region of code.
Title: Re: #region...#endregion
Post by: Parker on February 19, 2007, 09:12:50 PM
It was discussed elsewhere, but you won't be able to see it - it's in the developer's center. I figured out after looking at Scintilla's source code (May 13, 2006) that //{ and //} were already implemented in the C++ lexer, so they were used. No parser modifications required and it's already built in :)

But thanks for bringing this up, I didn't realize it wasn't in the public area.