DotJoshJohnson / vscode-xml

XML Tools for Visual Studio Code
MIT License
322 stars 86 forks source link

Inconsistent line break minification #262

Closed FranklinWhale closed 4 years ago

FranklinWhale commented 5 years ago

Description

The following XML document is handled properly by "Format Document" but not "XML Tools: Minify XML":

<tests>
<test>1.
2.
3.
4.</test>
<test xml:space="preserve">1.
2.
3.
4.</test>
<test>1.
 2.
 3.
 4.</test>
<test xml:space="preserve">1.
 2.
 3.
 4.</test>
</tests>

After "Format Document", the result is as follows, which is good:

<tests>
    <test>1.
2.
3.
4.</test>
    <test xml:space="preserve">1.
2.
3.
4.</test>
    <test>1.
 2.
 3.
 4.</test>
    <test xml:space="preserve">1.
 2.
 3.
 4.</test>
</tests>

However, with "XML Tools: Minify XML", text contents that have a whitespace before a EOL are normalized, which affects the meaning of those contents in whitespace sensitive applications:

<tests><test>1.
2.
3.
4.</test><test xml:space="preserve">1.
2.
3.
4.</test><test>1. 2. 3. 4.</test><test xml:space="preserve">1. 2. 3. 4.</test></tests>

The minifier should either stop text normalization when an ancestor element has xml:space="preserve" or change line breaks to &#x0D;, &#x0A; or &#x0D;&#x0A; depending on the EOL setting.

Formatter Implementation

v2

XML Tools Version

2.4.0

VS Code Version

1.31.1

Operating System

Windows 10 1809

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

FranklinWhale commented 5 years ago

Add comment to prevent the issue from being stale

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

FranklinWhale commented 5 years ago

Add comment to prevent the issue from being stale

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

FranklinWhale commented 5 years ago

Add comment to prevent the issue from being stale