You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Formatting.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,7 +155,7 @@ No changes to quotes will occur during formatting if `xml.format.enforceQuoteSty
155
155
156
156
### xml.format.preserveAttributeLineBreaks
157
157
158
-
Preserve line breaks that appear before and after attributes. This setting is overridden if [xml.format.splitAttributes](#xmlformatsplitattributes) is set to `true`. Default is `true`.
158
+
Preserve line breaks that appear before and after attributes. This setting is overridden if [xml.format.splitAttributes](#xmlformatsplitattributes) is set to `splitNewLine` or `alignWithFirstAttr`. Default is `true`.
159
159
160
160
If set to `true`, formatting does not change the following document:
161
161
@@ -241,21 +241,36 @@ If this value is set to 0, then all blank lines will be removed during formattin
241
241
242
242
### xml.format.splitAttributes
243
243
244
-
Set to `true` to split node attributes onto multiple lines during formatting. Defaults to `false`.
244
+
Set to `splitNewLine` to split node attributes onto multiple lines during formatting and set to `alignWithFirstAttr` to split node attributes after the first attribute to align with it.
245
+
246
+
Available values are `preserve`, `splitNewLine`, and `alignWithFirstAttr`. Defaults to `preserve`.
247
+
245
248
Overrides the behaviour of [xml.format.preserveAttributeLineBreaks](#xmlformatpreserveattributelinebreaks).
246
-
Please see [xml.format.splitAttributesIndentSize](#xmlformatsplitAttributesIndentSize) for information on configuring the indentation level of the attributes.
247
249
250
+
Please see [xml.format.splitAttributesIndentSize](#xmlformatsplitAttributesIndentSize) for information on configuring the indentation level of the attributes in the case of `splitNewLine`.
251
+
252
+
The following xml:
248
253
```xml
249
254
<projecta="1"b="2"c="3"></project>
250
255
```
251
-
becomes...
256
+
257
+
Remains the same when set to `preserve`.
258
+
259
+
When set to `splitNewLine`, becomes:
252
260
```xml
253
261
<project
254
262
a="1"
255
263
b="2"
256
264
c="3"></project>
257
265
```
258
266
267
+
When set to `alignWithFirstAttr`, becomes:
268
+
```xml
269
+
<projecta="1"
270
+
b="2"
271
+
c="3"></project>
272
+
```
273
+
259
274
***
260
275
261
276
### xml.format.joinCDATALines
@@ -453,7 +468,7 @@ If `xml.format.joinContentLines` is set to `true`, the above document becomes:
453
468
weight='20' />
454
469
</ROOT:root>
455
470
```
456
-
Note that it references two different external schemas. Additionally, the setting [`xml.format.splitAttributes`](#xmlformatsplitattributes) will be set to true for the formatted examples in order to make the formatted result easier to see.
471
+
Note that it references two different external schemas. Additionally, the setting [`xml.format.splitAttributes`](#xmlformatsplitattributes) will be set to `splitNewLine` for the formatted examples in order to make the formatted result easier to see.
457
472
458
473
* When it is set to `none`, the formatter does not change the content of `xsi:schemaLocation`. The above file would not change after formatting.
459
474
@@ -491,7 +506,7 @@ If `xml.format.joinContentLines` is set to `true`, the above document becomes:
491
506
492
507
### xml.format.splitAttributesIndentSize
493
508
494
-
Use to configure how many levels to indent the attributes by when [xml.format.splitAttributes](#xmlformatsplitAttributes) is set to `true`.
509
+
Use to configure how many levels to indent the attributes by when [xml.format.splitAttributes](#xmlformatsplitAttributes) is set to `splitNewLine`.
495
510
496
511
Here are some examples. For these examples, an indentation is two spaces.
497
512
@@ -559,7 +574,7 @@ If set to `true`, the closing bracket (`>` or `/>`) of a tag with at least 2 att
559
574
560
575
The closing bracket will have the same indentation as the attributes (if any), following the indent level defined by [splitAttributesIndentSize](#xmlformatsplitattributesindentsize).
561
576
562
-
Requires [splitAttributes](#xmlformatsplitattributes) to be set to `true`.
577
+
Requires [splitAttributes](#xmlformatsplitattributes) to be set to `splitNewLine` or `alignWithFirstAttr`.
Copy file name to clipboardExpand all lines: package.json
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -341,7 +341,7 @@
341
341
"xml.format.preserveAttributeLineBreaks": {
342
342
"type": "boolean",
343
343
"default": true,
344
-
"markdownDescription": "Preserve line breaks that appear before and after attributes. This setting is overridden if `#xml.format.splitAttributes#` is set to `true`. Default is `true`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Formatting%22%2C%22section%22%3A%22xmlformatpreserveattributelinebreaks%22%7D%5D) for more information.",
344
+
"markdownDescription": "Preserve line breaks that appear before and after attributes. This setting is overridden if `#xml.format.splitAttributes#` is set to `splitNewLine` or `alignWithFirstAttr`. Default is `true`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Formatting%22%2C%22section%22%3A%22xmlformatpreserveattributelinebreaks%22%7D%5D) for more information.",
345
345
"scope": "window"
346
346
},
347
347
"xml.format.preserveEmptyContent": {
@@ -404,9 +404,14 @@
404
404
"scope": "window"
405
405
},
406
406
"xml.format.splitAttributes": {
407
-
"type": "boolean",
408
-
"default": false,
409
-
"markdownDescription": "Split multiple attributes each onto a new line. Default is `false`. Indicate level of indentation with `#xml.format.splitAttributesIndentSize#`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Formatting%22%2C%22section%22%3A%22xmlformatsplitattributes%22%7D%5D) for more information.",
407
+
"type": "string",
408
+
"enum": [
409
+
"preserve",
410
+
"splitNewLine",
411
+
"alignWithFirstAttr"
412
+
],
413
+
"default": "preserve",
414
+
"markdownDescription": "Split multiple attributes each onto a new line or align attributes to the first. Default is `preserve`. Indicate level of indentation with `#xml.format.splitAttributesIndentSize#`. See [here](command:xml.open.docs?%5B%7B%22page%22%3A%22Formatting%22%2C%22section%22%3A%22xmlformatsplitattributes%22%7D%5D) for more information.",
0 commit comments