From 168adc3ab7f7bfbb0a1e3b8a16ff535d86d7e430 Mon Sep 17 00:00:00 2001 From: Adam Bouqdib Date: Mon, 6 Jul 2020 20:06:30 +0100 Subject: [PATCH] fix: prevent negative indentation --- src/formatting/formatters/v2-xml-formatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 {