Regionerate archive
An automatic layout enforcement tool for the C# programming language.
 

Main
Introduction
Tutorials
Download
Gallery
Blog
Documentation
Discuss
Source



 Subscribe in a reader

 Subscribe by e-mail



Omer Rauchwerger
omer at rauchy dot net



Speed Coding with Regionerate & GhostDoc, published Thursday, November 29, 2007

Here's a short screencast I created that demonstrates how I use free productivity enhancers such as GhostDoc (by Roland Weigelt), Regionerate and Visual Studio's built-in refactoring tools to quickly create and maintain skeleton code. It also demonstrates the usage of Regionerate's new Code Layout Browser.

I know there are some commercial tools that do more, but I'm just presenting a free (partial-)alternative. Make sure your speakers are turned on.


Can you think of other types of Code Layout? Comment here.
To prepare this screencast, I used CamStudio and Roy Osherove's KeyJedi.


kick it on DotNetKicks.com

Labels: , ,


2 comments. Add a comment.


New Version Available - v0.6.7.2, published Thursday, November 22, 2007

This version comes with a new feature called the Code Layout Browser. Yesterday I went to sleep with it in mind and just had to get it done today. I've been sitting in my favorite coffee place for like 6 hours now :-)

Read about the Code Layout Browser in my devblog post called Code Layout on Steroids!

To make the Code Layout Browser useful, I am also releasing several Code Layouts I use:

  • Contract First - Puts public stuff first, then all the rest.
  • Name Clustering - Separates fields, properties and methods by name clusters. (Fields starting with A-F, Fields starting with G-L etc')
  • NUnit Test Fixture - Separates initialization methods ([SetUp()], [TestFixtureSetUp()]), finalization methods ([TearDown()], [TestFixtureTearDown()]), test methods ([Test()]) and helper methods.
  • Plain Old CLR Object - Separates data members (fields, properties) from plumbing code (basically all the rest)
  • Regionless Layout - Unpacks all regions.

The new Code Layouts could use some work, I would appreciate any feedback in the General Discussion forum.

Also, if you have ideas for Code Layouts which will be useful to other users, send'em over!

You can download this version at the Downloads page.

Labels: ,


1 comments. Add a comment.


Adding Custom Code Layouts to the Code Layout Browser,

If  you have a custom Code Layout and you want to make it accessible through the Code Layout Browser, all you need to do is place it in the "My Code Layouts" folder under your installation folder. (Typically "C:\Program Files\Regionerate\My Code Layouts")

The file must have an .xml extension. The label inside the Code Layout Browser will be the same as the file name just without the extension. ("My Custom Code Layout.xml" will be shown as "My Custom Code Layout")

If you want to have a custom image assigned to it, just place a 128x128 png file in the same directory with the same name. For example, if you want to have a custom image for "My Custom Code Layout.xml", just name your image "My Custom Code Layout.png". If you don't place a custom image, the default image will be used.

Remember: if you have a custom Code Layout and want to use it as your primary Code Layout (the primary Code Layout is the one that will be accessible when hitting the keyboard shortcut without holding it down), use the settings dialog to select it.

Labels: , ,


0 comments. Add a comment.


New Version Available - v0.6.6.5, published Saturday, November 10, 2007

This one took quite a while. Thanks for holding on patiently. The reason for this big delay between v0.6.5.0 and v0.6.6.5 is a big refactoring job I had to do as a preparation for future features. Also, this version comes with quite a few new features and bug fixes.

I've learned a lesson from this version. I tried to squeeze too much into it and it ended up taking over 2 months. This really goes against the "release often" mantra which I believe strongly in. I paid the price and I can only hope I'll be smarter on next releases. My aim is to release every 3 weeks, even if things are not perfect.

New Features:

  1. The symbol mechanism has been completely rewritten and you can now choose from 3 different types of symbols (read more)
  2. You can now configure Regionerate to unpack specific existing regions.  (read more. Thanks to Krzysztof Kozmic for the idea!)
  3. Nested classes are recursively Regionerated.

Bug Fixes:

  1. A known issue from v0.2 - Curly brace issue solved.
  2. Another known issue from v0.6 - Supportng #if-#endif blocks.
  3. Generic Constraints stop Regionerate (reported here)
  4. Better spacing for existing regions. (reported here)
  5. Extraneous #endregions after Regionerating (reported here)
  6. Protected internal methods being ignored (reported here)
  7. Breaking at semicolons in string (reported here)

Please note that since this version had a big refactoring job, it is unstable and will probably induce some bugs. v0.6.6.5 can only be downloaded in "Latest" folder. The "Stable" folder still has v0.6.5.0 at the moment.

If no critical bugs pop up in the next two weeks or so, I will move this version to the "Stable" folder.

You can download this version at the Downloads page.

Labels: ,


2 comments. Add a comment.


Configuration,

The Configuration element in your Code Layout document can be used to configure certain settings that define Regionerate's behavior. These settings are shared between all layouts inside the Code Layout document.

  • The Symbol element can be used to determine which symbol is embedded in your regions. (What Are Symbols?)
  • Use the Unpack element to open certain existing regions. (Read more about unpacking)
  • Rendering options:
    • ShowCount - Determines if Regionerated regions will automatically and recursively count their children.
    • Tabs - The amount of tab characters Regionerated regions declarations have.
    • UseTabs – Determines if regions should be indented using tabs. (otherwise, they will be indented with spaces)
    • Spaces- The amount of space characters Regionerated regions declarations have.

Labels: ,


0 comments. Add a comment.


Unpacking,

The term "Unpacking" refers to a pre-processing stage that occurs before your code is analyzed and constructed. When Regionerate unpacks your code, it strips up all members from regions which are managed by it ("Regionerated regions"). After the code is shaped according to the Code Layout, these members are packed back into their regions.

While Regionerate automatically handles Regionerated regions, it allows  you to specify which additional regions should be unpacked.

For example, you might have some regions that were generated by the IDE or a 3rd party tool for default interface implementations, such as:

   1:      public class Foo : IList<string>
   2:      {
   3:          #region IList<string> Members
   4:   
   5:          ...
   6:   
   7:          #endregion
   8:   
   9:          #region ICollection<string> Members
  10:   
  11:          ...
  12:   
  13:          #endregion
  14:      }

You can use the Unpack element under Configuration inside your Code Layout document to tell Regionerate to unpack any interface that matches a regular expression. For example:


<Configuration>
    ...
    <Unpack>
        <Regions ThatMatch="I.*\sMembers" />
    </Unpack>
</Configuration>



 

If you use the unpack command as above, every time you implement an interface, it will be unpacked and merged into the layout.

 

   1:      public class Foo : IList<string>
   2:      {
   3:   
   4:          #region Properties (3) 
   5:   
   6:          ...
   7:   
   8:          #endregion Properties 
   9:   
  10:          #region Methods (10) 
  11:   
  12:          ...
  13:   
  14:          #endregion Methods 
  15:   
  16:      }



Another possible use for unpacking is when migrating between symbols. If you used the Prefix symbol (the only option in versions prior to v0.6.6.5) long enough you have a code base filled with regions that look like:


#region [rgn] Fields (3)




If you change the symbol (lets say, from a Prefix to a Hidden Dragon), Regionerate will unpack and pack only regions the have the Hidden Dragon embedded in them, meaning that all "[rgn]" regions will stay untouched.


To migrate to the new symbol, you should tell Regionerate to unpack "[rgn]" regions:


   1:  <Configuration>
   2:      <Symbol>
   3:          <HiddenDragon />
   4:      </Symbol>
   5:      <Unpack>
   6:          <Regions ThatMatch="\[rgn\]" />
   7:      </Unpack>
   8:  </Configuration>



This way, the first time a code file is Regionerated with the new settings, Regionerate first unpacks all the old "[rgn]" regions and then it merges all the members into new Hidden Dragon symbolized regions.


Labels: ,


0 comments. Add a comment.


What Are Symbols?,

By using symbols Regionerate knows which regions are self-managed ("Regionerated regions") and which regions should be kept untouched ("exisiting regions") .

Up until v0.6.6.5, symbols were visible as prefixes before the name of the region, for example:

#region [rgn] Fields (5)

 

Now you can choose between 3 different types of symbols:


1. Hidden Dragon - (default) The Hidden Dragon is a special character (#255) which is not considered whitespace, yet not visible. If you use the Hidden Dragon, the symbol will be transparently embedded in your region declarations and will look like this:


#region Fields (5)

I would recommend you keep using the Hidden Dragon unless you stumble upon any trouble with it or if you want to be able to visually identify Regionerated regions.


2. Prefix - Allows you to add a prefix to Regionerated region headers, for example:



#region [rgn] Fields (5)

3. Wrapper - Allows you to add a prefix and a suffix to Regionerated region headers, for example:



#region [Fields (5)]

The symbol can be declared in your Code Layout document under the Configuration element.


 

<Configuration>
    <Symbol>
        <HiddenDragon />
    </Symbol>
    ...
</Configuration>



 



Labels: ,


0 comments. Add a comment.


Read more news from
  • May 2007
  • June 2007
  • July 2007
  • August 2007
  • November 2007
  • December 2007
  • January 2008
  • August 2008
  • September 2008
  • December 2008
  • March 2009

    Contribute
    I'm currently looking for good people to help me with the remaining development tasks for Regionerate v1.0. If you like Regionerate and want to be a part of it, contact me at omer at rauchy dot net.

    Release plan
    • Private Alpha (v0.2) -- complete.
    • Private Beta (v0.4) -- complete.
    • Public Beta (v0.6) -- complete.
    • Beta 2 (v0.7) -- current stage.
    • Release Candidate (v0.8) -- being developed.
    • Release (v1.0)



  • Omer Rauchwerger omer at rauchy dot net
    Feed me
    Distributed under the
    GNU general public license.