Format XML documents in your favorite way.
Q & A
- Enable modify attributes does not work.
- There maybe some escape chars in your xml like "<",">".
- Leastest update may cause this problem, try resetting 'splitedAttributesAlign'
Features
Extension Settings
- removeEmptyLines: Remove empty lines.
- symmetricalTagPair: Let the tags in pair be symetrical to their content.
- enableModifyAttributes: Merge attributes into one line or split them to new lines.
- splitAttributesLimit: The limit that when the count of attributes are more than (include), they will be split to new lines.
- splitAttributesByLength: It works when > 0 and will override 'Split Attributes Limit'. When line length > it, the line will be split to new lines.
- (new) splitedAttributesAlign: The new line align in your way.
- (new) splitAttributesByLengthCountType: It works with 'split Attributes By Length'.
- enableAddLeftSpace: Auto add space on the left side of '='.
- enableAddRightSpace: Auto add space on the right side of '='
- enableAddEndSpace: Auto add space before '/>'.
- useVSCodeIndent: Use VSCode's indent. If false, use own tabSize
- ownTabSize: When 'useVSCodeIndent' is false, it works
- (new) autoQuotation: Auto set all quotations to single quotation or double quotation or not.
Example
removeEmptyLines:
--------------------------------------------------before
<a>
<b/>
</a>
--------------------------------------------------after
<a>
<b/>
</a>
symmetricalTagPair:
--------------------------------------------------before1
<a>xxxx
</a>
--------------------------------------------------after1
<a>xxxx</a>
--------------------------------------------------before2
<a>
xxxx</a>
--------------------------------------------------after2
<a>
xxxx
</a>
--------------------------------------------------before3
<a>
xxxx</a>
--------------------------------------------------after3
<a>
xxxx
</a>
enableModifyAttributes==by length & splitAttributesByLength:
if splitAttributesByLength == 20
--------------------------------------------------before1
<aaaaaa xxx='1' yyy='2' zzz= '3' />
--------------------------------------------------after1
<aaaaaa xxx='1' yyy='2'
zzz='3' />
--------------------------------------------------before2
<aaaaaa xxx='1' yyy='2' zzz= '3' www='4' uuu='5' vvv='6' />
--------------------------------------------------after2
<aaaaaa xxx='1' yyy='2'
zzz='3' www='4'
uuu='5' vvv='6' />
enableModifyAttributes==by number & splitAttributesLimit:
if splitAttributesLimit == 4
--------------------------------------------------before1
<aaaaaa xxx='1' yyy='2'
zzz= '3' />
--------------------------------------------------after1
<aaaaaa xxx='1' yyy='2' zzz='3' />
--------------------------------------------------before2
<aaaaaa xxx='1' yyy='2'
zzz= '3' www='4' />
--------------------------------------------------after2
<aaaaaa xxx='1'
yyy='2'
zzz='3'
www='4' />
enableModifyAttributes & splitedAttributesAlign:
if splitedAttributesAlign == tab
--------------------------------------------------before2
<aaaaaa xxx='1' yyy='2'
zzz= '3' www='4' />
--------------------------------------------------after2
<aaaaaa xxx='1'
yyy='2'
zzz='3'
www='4' />
if splitedAttributesAlign == upper
--------------------------------------------------before2
<aaaaaa xxx='1' yyy='2'
zzz= '3' www='4' />
--------------------------------------------------after2
<aaaaaa xxx='1'
yyy='2'
zzz='3'
www='4' />
enableAddLeftSpace & enableAddRightSpace & enableAddEndSpace:
--------------------------------------------------before
<a b='1'/>
--------------------------------------------------after
<a b = '1' />
Release Notes
1.3.0
Add some configs.
Comments now align as a node.
1.2.2
Add some configs to auto tab size
1.1.0
Add some configs to auto add space
1.0.0
Initial release
| |