Expose Initial Indent Level
This commit is contained in:
parent
46f89911a2
commit
54ff41c736
@ -29,7 +29,7 @@ export class V2XmlFormatter implements XmlFormatter {
|
|||||||
|
|
||||||
let output = "";
|
let output = "";
|
||||||
|
|
||||||
let indentLevel = 0;
|
let indentLevel = options.initialIndentLevel;
|
||||||
let attributeQuote = "";
|
let attributeQuote = "";
|
||||||
let lineBreakSpree = false;
|
let lineBreakSpree = false;
|
||||||
let lastWordCharacter: string | undefined;
|
let lastWordCharacter: string | undefined;
|
||||||
@ -194,7 +194,7 @@ export class V2XmlFormatter implements XmlFormatter {
|
|||||||
&& cc === "/"
|
&& cc === "/"
|
||||||
&& pc !== " "
|
&& pc !== " "
|
||||||
&& options.enforcePrettySelfClosingTagOnFormat) {
|
&& options.enforcePrettySelfClosingTagOnFormat) {
|
||||||
output += " /";
|
output += " /";
|
||||||
}
|
}
|
||||||
|
|
||||||
// exiting StartTag or StartTag.StartTagName, entering Text
|
// exiting StartTag or StartTag.StartTagName, entering Text
|
||||||
|
@ -10,6 +10,7 @@ export interface XmlFormattingOptions {
|
|||||||
removeCommentsOnMinify: boolean;
|
removeCommentsOnMinify: boolean;
|
||||||
splitAttributesOnFormat: boolean;
|
splitAttributesOnFormat: boolean;
|
||||||
splitXmlnsOnFormat: boolean;
|
splitXmlnsOnFormat: boolean;
|
||||||
|
initialIndentLevel: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class XmlFormattingOptionsFactory {
|
export class XmlFormattingOptionsFactory {
|
||||||
@ -20,7 +21,8 @@ export class XmlFormattingOptionsFactory {
|
|||||||
newLine: (document.eol === EndOfLine.CRLF) ? "\r\n" : "\n",
|
newLine: (document.eol === EndOfLine.CRLF) ? "\r\n" : "\n",
|
||||||
removeCommentsOnMinify: Configuration.removeCommentsOnMinify(document.uri),
|
removeCommentsOnMinify: Configuration.removeCommentsOnMinify(document.uri),
|
||||||
splitAttributesOnFormat: Configuration.splitAttributesOnFormat(document.uri),
|
splitAttributesOnFormat: Configuration.splitAttributesOnFormat(document.uri),
|
||||||
splitXmlnsOnFormat: Configuration.splitXmlnsOnFormat(document.uri)
|
splitXmlnsOnFormat: Configuration.splitXmlnsOnFormat(document.uri),
|
||||||
|
initialIndentLevel: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user