parent
8f0bf58462
commit
9941bafa74
5 changed files with 14 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue