forked from external/vscode-xml
parent
b65009728c
commit
af2060dc38
@ -39,6 +39,7 @@ export class V2XmlFormatter implements XmlFormatter {
|
|||||||
const nc = xml.charAt(i + 1);
|
const nc = xml.charAt(i + 1);
|
||||||
const nnc = xml.charAt(i + 2);
|
const nnc = xml.charAt(i + 2);
|
||||||
const pc = xml.charAt(i - 1);
|
const pc = xml.charAt(i - 1);
|
||||||
|
const ppc = xml.charAt(i - 2);
|
||||||
|
|
||||||
// entering CData
|
// entering CData
|
||||||
if (location === Location.Text && cc === "<" && nc === "!" && nnc === "[") {
|
if (location === Location.Text && cc === "<" && nc === "!" && nnc === "[") {
|
||||||
@ -86,7 +87,8 @@ export class V2XmlFormatter implements XmlFormatter {
|
|||||||
// entering StartTag.StartTagName
|
// entering StartTag.StartTagName
|
||||||
else if (location === Location.Text && cc === "<" && ["/", "!"].indexOf(nc) === -1) {
|
else if (location === Location.Text && cc === "<" && ["/", "!"].indexOf(nc) === -1) {
|
||||||
// if this occurs after another tag, prepend a line break
|
// if this occurs after another tag, prepend a line break
|
||||||
if (pc === ">") {
|
// but do not add one if the previous tag was self-closing (it already adds its own)
|
||||||
|
if (pc === ">" && ppc !== "/") {
|
||||||
output += `${options.newLine}${this._getIndent(options, indentLevel)}<`;
|
output += `${options.newLine}${this._getIndent(options, indentLevel)}<`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user