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
Add new formatting setting xml.format.splitAttributesIndentSize
Add a new setting which controls the level of indentation of attributes
with respect to their parent element when `xml.format.splitAttributes`
is set to `true`.
Based off of a comment by Cong Wang (@I322871) on the vscode-xml Gitter
Signed-off-by: David Thompson <davthomp@redhat.com>
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,9 +32,9 @@ This VS Code extension provides support for creating and editing XML documents,
32
32
* Code actions
33
33
* Schema Caching
34
34
35
-
See the [changelog](CHANGELOG.md) for the latest release.
35
+
See the [changelog](CHANGELOG.md) for the latest release.
36
36
37
-
You might also find useful information in the [Online XML Documentation](https://github.com/redhat-developer/vscode-xml/blob/master/docs/README.md)
37
+
You might also find useful information in the [Online XML Documentation](https://github.com/redhat-developer/vscode-xml/blob/master/docs/README.md)
38
38
or you can read this documentation inside vscode with the command `Open XML Document` available with `Ctrl+Shift+P`:
39
39
40
40

@@ -46,7 +46,7 @@ or you can read this documentation inside vscode with the command `Open XML Docu
46
46
*`xml.java.home` in VSCode preferences
47
47
*`java.home` in VSCode preferences
48
48
* Environment variable `JAVA_HOME` or `JDK_HOME`
49
-
***Note**: The path should end at the parent folder that contains the `bin` folder.
49
+
***Note**: The path should end at the parent folder that contains the `bin` folder.
50
50
**Example Path**: `/usr/lib/jvm/java-1.8.0` if `bin` exists at `/usr/lib/jvm/java-1.8.0/bin`.
51
51
***Note**: If the path is not set, the extension will attempt to find the path to the JDK or JRE.
52
52
@@ -57,7 +57,7 @@ See [how to set java home](https://github.com/redhat-developer/vscode-xml/blob/m
57
57
The following settings are supported:
58
58
59
59
*[`xml.java.home`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#java-home): Set the Java path required to run the XML Language Server. If not set, falls back to either the `java.home` preference or the `JAVA_HOME` or `JDK_HOME` environment variables.
60
-
*[`xml.server.vmargs`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#server-vm-arguments): Specifies extra VM arguments used to launch the XML Language Server.
60
+
*[`xml.server.vmargs`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#server-vm-arguments): Specifies extra VM arguments used to launch the XML Language Server.
61
61
Eg. use `-Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication` to bypass class verification, increase the heap size to 1GB and enable String deduplication with the G1 Garbage collector.
62
62
*[`xml.server.workDir`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#server-cache-path): Set a custom folder path for cached XML Schemas. An absolute path is expected, although the `~` prefix (for the user home directory) is supported. Default is `~/.lemminx`.
63
63
*`xml.trace.server`: Trace the communication between VS Code and the XML language server in the Output view. Default is `off`.
@@ -70,15 +70,16 @@ The following settings are supported:
70
70
*[`xml.format.joinCDATALines`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatjoincdatalines): Set to `true` to join lines in CDATA content during formatting. Default is `false`.
71
71
*[`xml.format.joinCommentLines`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatjoincommentlines): Set to `true` to join lines in comments during formatting. Default is `false`.
72
72
*[`xml.format.joinContentLines`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatjoincontentlines): Normalize the whitespace of content inside an element. Newlines and excess whitespace are removed. Default is `false`.
73
-
*[`xml.format.preserveAttributeLineBreaks`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatpreserveattributelinebreaks): Preserve line breaks that appear before and after attributes. Default is `false`.
73
+
*[`xml.format.preserveAttributeLineBreaks`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatpreserveattributelinebreaks): Preserve line breaks that appear before and after attributes. Default is `false`.
74
74
**IMPORTANT**: This setting is overridden if `xml.format.splitAttributes` is set to `true`.
75
75
*[`xml.format.preserveEmptyContent`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatpreserveemptycontent): Preserve empty content/whitespace in a tag. Default is `false`.
76
76
*[`xml.format.preservedNewLines`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatpreservednewlines): Preserve new lines that separate tags. The value represents the maximum number of new lines per section. A value of 0 removes all new lines. Default is `2`.
77
-
*[`xml.format.spaceBeforeEmptyCloseTag`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatspacebeforeemptyclosetag): Insert space before end of self closing tag.
77
+
*[`xml.format.spaceBeforeEmptyCloseTag`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatspacebeforeemptyclosetag): Insert space before end of self closing tag.
78
78
Example: ```<tag/> -> <tag />```. Default is `true`.
79
79
*[`xml.format.splitAttributes`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatsplitattributes): Split multiple attributes each onto a new line. Default is `false`.
80
+
*[`xml.format.splitAttributesIndentSize`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatsplitattributesindentsize): How many levels to indent the attributes by when `xml.format.splitAttributes` is `true`. Default value is `2`.
80
81
*`xml.preferences.quoteStyle`: Preferred quote style to use for completion: `single` quotes, `double` quotes. Default is `double`.
81
-
*`xml.autoCloseTags.enabled` : Enable/disable autoclosing of XML tags. Default is `true`.
82
+
*`xml.autoCloseTags.enabled` : Enable/disable autoclosing of XML tags. Default is `true`.
82
83
**IMPORTANT**: The following settings must be turned of for this to work: `editor.autoClosingTags`, `editor.autoClosingBrackets`.
83
84
*[`xml.codeLens.enabled`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/CodeLens.md): Enable/disable XML CodeLens. Default is `false`.
84
85
*[`xml.preferences.showSchemaDocumentationType`](https://github.com/redhat-developer/vscode-xml/blob/master/docs/Preferences.md#documentation-type): Specifies the source of the XML schema documentation displayed on hover and completion. Default is `all`.
Copy file name to clipboardExpand all lines: docs/Formatting.md
+64-1Lines changed: 64 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,8 @@ If this value is set to 0, then all blank lines will be removed during formattin
148
148
### xml.format.splitAttributes
149
149
150
150
Set to `true` to split node attributes onto multiple lines during formatting. Defaults to `false`.
151
-
Overrides the behaviour of [xml.format.preserveAttributeLineBreaks](#xmlformatpreserveattributelinebreaks)
151
+
Overrides the behaviour of [xml.format.preserveAttributeLineBreaks](#xmlformatpreserveattributelinebreaks).
152
+
Please see [xml.format.splitAttributesIndentSize](#xmlformatsplitAttributesIndentSize) for information on configuring the indentation level of the attributes.
152
153
153
154
```xml
154
155
<projecta="1"b="2"c="3"></project>
@@ -332,4 +333,66 @@ If it is set to `true`, the above document becomes:
332
333
```
333
334
334
335
***
336
+
### xml.format.splitAttributesIndentSize
335
337
338
+
Use to configure how many levels to indent the attributes by when [xml.format.splitAttributes](#xmlformatsplitAttributes) is set to `true`.
339
+
340
+
Here are some examples. For these examples, an indentation is two spaces.
0 commit comments