diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index d38752d..8eed3d7 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -291,7 +291,7 @@ export class V2XmlFormatter implements XmlFormatter { } private _getIndent(options: XmlFormattingOptions, indentLevel: number): string { - return ((options.editorOptions.insertSpaces) ? " ".repeat(options.editorOptions.tabSize) : "\t").repeat(indentLevel); + return ((options.editorOptions.insertSpaces) ? " ".repeat(options.editorOptions.tabSize) : "\t").repeat(Math.max(indentLevel, 0)); } private _removeTrailingNonBreakingWhitespace(text: string): string {