views:

265

answers:

2

Our coding standards have us putting each attribute within a tag on a separate line. However, when I have VS (2008) format the markup is lumps all the attributes together. Is there a way to change this behavior??

Thanks

A: 

I have not found any options within Visual Studio itself that would allow you to force your attribute to format this way. It seems that you have two options:

1) Go into Tools->Options->Text Editor->HTML and remove all the formating stuff (or as much as you need).

2) Find a coding-style plugin that allows this to be specified. I use Microsoft StyleCop, but it functions more as a check on already written code. Still, it allows custom rules to be written and writing one for your rule would not be difficult.

TahoeWolverine
A: 

If you are working with HTML, you may be out of luck without an add-in to Visual Studio.

However, VS is capable of formatting XAML this way, as it is a popular convention for many XAML developers.

To enable this formatting for XAML go to Tools > Options > Text Editor > XAML > Formatting > Spacing and select "Position each attribute on a separate line"

Ben Elder