views:

22

answers:

1

I know that in the Tools > Options (Text Editor > CSS > Format) menu I can choose between three types of document formatting for CSS files (compact, semi-expanded and expanded) as well as capitalization.

A decision has been made in my organization to implement a formatting structure in XML files, where the attributes for an element line up on successive lines like this:

<ElementName attribute1="someValue"
             attribute2="someOtherValue" 
             attribute3="yaddayaddayadda" />
  1. Is there a way to define custom formatting rules for XML files so that when I format the document with Ctrl+K, Ctrl+D I get the desired result?
  2. Is there a way to define a "rule" that will insert the correct number of spaces on the second line after I finish typing the first attribute?
  3. Is there a way to have code snippets follow these rules when pasting in the snippet?

Thanks in advance for any suggestions.

Scott.

+1  A: 

No there is no way to customize XML document formatting to this level in Visual Studio. It only allows for much coarser grained formatting.

I think your only option is to use another tool to ensure formatting of documents and have that tool run on build / save of the documents in question. Essentially StyleCop for your XML documents.

JaredPar
Not the answer I wanted to hear, obviously... but thanks just the same. +1 for that rapid response.
ScottSEA