HookyQR / VSCodeBeautify

Enable js-beautify (https://github.com/beautify-web/js-beautify) in VS Code
MIT License
607 stars 178 forks source link

Inner HTML whitespace is added when wrapping #369

Closed clshortfuse closed 3 years ago

clshortfuse commented 3 years ago

NOTE: Please provide code snippets instead of screen shots. Your issue needs to be replicated, and we need the failing code (text) to do this.

Provide the settings you use: .jsbeautifyrc

{
  "html": {
    "wrap_line_length": 80
  }
}

Action performed

Format javascript file with HookyQR.beautifyFile command

<div style="white-space:pre;">This text is a very long block of text that should not be modified. Unfortunately, formatters can't know if adding whitespace would affect render.</div>
<div style="white-space:pre;" setofAttributes="true" thatCanBeWrapped="yes">Instead of this</div>

Expected results

<div style="white-space:pre;">This text is a very long block of text that should not be modified. Unfortunately, formatters can't know if adding whitespace would affect render.</div>
<div style="white-space:pre;" setofAttributes="true"
  thatCanBeWrapped="yes">Instead of this</div>

Actual results

<div style="white-space:pre;">This text is a very long block of text that should
    not be modified. Unforunately, formatters can't know if adding whitespace
    would affect render.</div>
<div style="white-space:pre;" setofAttributes="true" thatCanBeWrapped="yes">
    Instead of this</div>

I can understand how the first one would be a bit more difficult to fix, perhaps needing a new property. (Prettier has a Whitespace sensitivity option), but the second line could probably be default.

clshortfuse commented 3 years ago

Closing this in favor of filing this against js-beautify