forked from external/vscode-xml
parent
8f0bf58462
commit
9941bafa74
@ -17,8 +17,9 @@
|
||||
* `xmlTools.ignoreDefaultNamespace`: Ignore default xmlns attributes when evaluating XPath.
|
||||
* `xmlTools.persistXPathQuery`: Remember the last XPath query used.
|
||||
* `xmlTools.removeCommentsOnMinify`: Remove XML comments during minification.
|
||||
* `xmlTools.splitAttributesOnFormat`: Put each attribute on a new line when formatting XML. Overrides `xmlTools.splitXmlsOnFormat` if set to `true`. (V2 Formatter Only)
|
||||
* `xmlTools.splitXmlnsOnFormat`: Put each xmlns attribute on a new line when formatting XML.
|
||||
* `xmlTools.xmlFormatterImplementation`: Supported XML Formatters: `classic`.
|
||||
* `xmlTools.xmlFormatterImplementation`: Supported XML Formatters: `classic`, `v2`.
|
||||
* `xmlTools.xqueryExecutionArguments`: Arguments to be passed to the XQuery execution engine.
|
||||
* `xmlTools.xqueryExecutionEngine`: The full path to the executable to run when executing XQuery scripts.
|
||||
|
||||
|
@ -80,6 +80,12 @@
|
||||
"description": "Remove XML comments during minification.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"xmlTools.splitAttributesOnFormat": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Put each attribute on a new line when formatting XML. Overrides `xmlTools.splitXmlsOnFormat` if set to `true`.",
|
||||
"scope": "resource"
|
||||
},
|
||||
"xmlTools.splitXmlnsOnFormat": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
|
@ -87,6 +87,10 @@ export class V2XmlFormatter implements XmlFormatter {
|
||||
|
||||
// entering StartTag.Attribute
|
||||
else if (location === Location.StartTag && [" ", "/", ">"].indexOf(cc) === -1) {
|
||||
if (lastNonTextLocation === Location.AttributeValue && ((options.splitXmlnsOnFormat && xml.substr(i, 5).toLowerCase() === "xmlns") || options.splitAttributesOnFormat)) {
|
||||
output += `${options.newLine}${this._getIndent(options, indentLevel)}`;
|
||||
}
|
||||
|
||||
output += cc;
|
||||
lastNonTextLocation = location;
|
||||
location = Location.Attribute;
|
||||
|
@ -31,6 +31,7 @@ export class XmlFormattingEditProvider implements DocumentFormattingEditProvider
|
||||
editorOptions: options,
|
||||
newLine: (document.eol === EndOfLine.CRLF) ? "\r\n" : "\n",
|
||||
removeCommentsOnMinify: this.workspaceConfiguration.get<boolean>("removeCommentsOnMinify"),
|
||||
splitAttributesOnFormat: this.workspaceConfiguration.get<boolean>("splitAttributesOnFormat"),
|
||||
splitXmlnsOnFormat: this.workspaceConfiguration.get<boolean>("splitXmlnsOnFormat")
|
||||
});
|
||||
|
||||
|
@ -4,5 +4,6 @@ export interface XmlFormattingOptions {
|
||||
editorOptions: FormattingOptions;
|
||||
newLine: string;
|
||||
removeCommentsOnMinify: boolean;
|
||||
splitAttributesOnFormat: boolean;
|
||||
splitXmlnsOnFormat: boolean;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user