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.
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 :-)
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.
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:
The symbol mechanism has been completely rewritten and you can now choose from 3 different types of symbols (read more)
You can now configure Regionerate to unpack specific existing regions. (read more. Thanks to Krzysztof Kozmic for the idea!)
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.
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.
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: publicclass 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>
<RegionsThatMatch="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: publicclass 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: <RegionsThatMatch="\[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.
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.
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.