DotJoshJohnson / vscode-xml

XML Tools for Visual Studio Code
MIT License
320 stars 87 forks source link

One word causes XML formatter to fail #294

Closed Amarok24 closed 3 years ago

Amarok24 commented 4 years ago

Description

A valid XML cannot be formatted by XML Formatter. Error message: Running the contributed command 'xmlTools.formatAsXml' failed. See attached screenshot of a most simple case. If the word "ThisCausesBug" (line 13) is removed then the XML can be formatted. Or: if the IMG on line 15 is removed the XML can be formatted as well.

Formatter Implementation

v2

XML Tools Version

2.5.0

VS Code Version

1.40.2

Operating System

Windows_NT x64 10.0.18362

xmlformatter-error

DotJoshJohnson commented 4 years ago

I am not able to reproduce this. Can you attach a file or paste an example (not a screenshot) of XML that produces the error? Thanks!

Amarok24 commented 3 years ago

Hi, sorry for the late reply. Here is the XML code from the screenshot, I just had to rename the extension from xml to txt, Github didn't allow me to upload an xml file. test.txt

When you run the source formatting with XML Tools (I am currently using v2.5.1, VSCode version 1.47.3) then the resulting code has wrong alignment especially on lines 19 (closing div) and 21 (closing xsl:template), which do not line up with lines 11 and 13 respectively. test-formatted.txt Once you remove the word "ThisCausesBug" and re-run code formatting then everything is aligned perfectly.

BR, Jan