|
|
Getting Started With Code Layouts,
published Sunday, June 17, 2007
Here's a quick guide to get you started on writing your own Code Layout. Code Layouts are simply XML files which follow the Code Layout Schema.
The Code Layout Schema (CodeLayoutSchema.xsd) can be found in your installation directory. If you are using Visual Studio, the Code Layout Schema is copied during installation into your Visual Studio Schemas directory.
Here are the steps neccesary to start writing a custom Code Layout in Visual Studio: - Create a new XML file in Visual Studio (File->New->File->XML File->Open)
- Type in "<CodeLayout xmlns="http://regionerate.net/schemas/0.6/CodeLayout.xsd">" (substitue 0.6 to the current version you are working with).
If you are using Visual Studio, the file should be linked to the Code Layout Schema immediatly, and you should be able to receive intellisense assistance. If you are not using Visual Studio, or for some reason you are not getting intellisense assitance: - Open the Properties window for the XML file.
- Choose "Schemas" and click on the button.
- Click on "Add" and browse for the CodeLayoutSchema.xsd file under your installation directory. (typically C:\Program Files\Regionerate)
- Click OK. The XML file is now validated by the Code Layout Schema.
The Code Layout Schema structure is pretty simple, I'm sure you'll manage from here. Once you have your Code Layout all ready, you can easily load it into the Visual Studio add-in by following these steps: - Click on Tools->Regionerate Settings.
- Under "Code Layout" check "Use Custom".
- Hit the "Browse" button and browse for your custom Code Layout.
- Click "Save".
If you are having any difficulties with the structure of the Code Layout Schema, post a comment this post and I'll expand on the topic.Labels: Code Layout, Documentation
8 comments. Add a comment.
On June 24, 2007 12:42 PM, Hermann Klinke said:
First of all, I would like to thank you, I find Regionerate very very useful. I've been playing around with a custom code style and it has been really easy to customize it to my liking. There is only one thing though that I would like to accomplish. I would like to put fields that belong to a property above the property, so that the field being accessed or manipulated in the property appears above the property. It should look like this:
private int _name; public int Name { set {_name = value;} get { return _name;} }
Is this possible?
On June 24, 2007 3:17 PM, Omer Rauchwerger said:
Hermann,
You are most welcome, I am glad you find it useful.
Your suggestion is good and I have already heard it from other users. I plan to implement this in the next release (shouldn't be long from now)
Thank you, rauchy.
On June 24, 2007 5:45 PM, Ken LeFebvre said:
I'd like to second the idea of putting encapsulated private fields with their public property accessors.
Also, is there a way to do an "OR" with the Where clause? For instance, I generally create a region for all my Private, Protected, and Internal Fields and a separate region for my Public fields.
This is definitely a must-have add-in, Rauchy! I'll be recommending it to all my friends!
On June 24, 2007 6:54 PM, Omer Rauchwerger said:
Ken,Thank you for your feedback. You can easily create OR statements by specifying multiple put commands.For example, if you want to create a region for private or protected fields:
< CreateRegion Name="Private and Protected Fields"> < PutFields> < Where>< Access="Private" /></Where> </PutFields> < PutFields> < Where>< Access="Protected" /> </Where></PutFields> </CreateRegion>
Hope this helps,rauchy.
On June 25, 2007 5:14 PM, said:
So far this looks really nice. I have run across a problem where the attributes for an event are not being moved with the event. You end up with the event in the region and the attributes and comments orphaned.
On June 25, 2007 5:40 PM, Omer Rauchwerger said:
Eric & everybody,
Please use the forums for bug reports and/or suggestions. (The comment interface is much more limited than the forums)
Thanks, -- rauchy.
On August 30, 2007 7:08 PM, said:
Hi rauchy,
This is an excellent tool, it looks very handy. The only thing is, I'd like to create a region for every method in a class, grouping overloads together. For instance:
#region MyMethod public void MyMethod(string someParam) { }
public void MyMethod() { }
#endregion
This would need to work for public and private methods of course. Is this possible?
Thanks for your reply.
On September 3, 2007 9:43 PM, Omer Rauchwerger said:
JP,
Thank you, I'm glad you like Regionerate.
Creating a region for each method (group by overloads) is a very interesting idea.
I suggest you post this at the feature request forum so that other users will be able to share their opinions on it and will be able to track the request and its development status.
Thanks!
|
|