Regionerate – very cool plugin for VS and #Develop

Today I found (via Roy’s post) very nice plugin that works with both Visual Studio and SharpDevelop. It’s called Regionerate, is free and is developed by Omer Rauchwerger. As Omer wrote:

Regionerate (pronounced ri-jeh-neh-rate) is a new open-source tool for developers and team leaders that allows you to automatically apply layout rules on C# code.

regBefore I feel very happy to find it, since it does exactly this, what I wanted for a long time, and it’s something that neither Refactor! Pro, nor ReSharper allows you to do. At the moment it’s in its infancy (current version is 0.6beta) but even now it’s very handy, works quite fast, has integration with NAnt, and enables you to customize it’s behavior by editing xml file. It has even xml schema attached, so you’ll get intellisence and description of elements as you type.

Ok but, what exactly means ‘automatically apply layout rules’? Basically if you have a class like on the 1st screenshot that is messy it helps you do cleaning. Look at the code, it starts with private member declaration, then one method, then some property, next another field, then constructor and so on. This class is short and simple but imagine complicated class with many fields, methods, constructors, properties, events and so on. It’s very easy to make class a nightmare to find some member without ctrl+f.

Regionerate helps you keep your classes clean. If you have code like this you can right click, select Regionerate this, and let the magic happen. regMenu

rgnAfter With two clicks you can go from code like in 1st screenshot, to code like this, with elements gathered together, sorted by type or alphabetically and optionally embedded in a #region (with count of elements inside. And you can have your own, custom regions, for example if you want to keep read only properties separated from other, you can, if you have many methods (or any other elements) you can separate them by accessibility (private public, protected) you can keep static methods separately of methods overriding or hiding (with ‘new’ keyword) base class implementations – you can totally do that. Future releases will give you even more options and flexibility, so it’s definitely project worth keeping an eye on. Oh, and if you want to see it in action before you download it, here is very short screencast showing its capabilities.