NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹

Home Page:prettier-plugin-go-template-niklaspor.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Closing tag is spit on log tags and log lines

spez opened this issue · comments

With a long line with a long tag name, the closing tag gets split and the contents are not indented.

Before

<textarea id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">foo</textarea>

After

<textarea id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
foo</textarea
>

It works as expected with a div:

Before

<div id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">foo</div>

After (as expected)

<div id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
  foo
</div>

It looks like it's an issue with prettier/parser-html.

I also stumbled upon this and thought it was an issue. In case anyone else arrives here I found some documentation from Prettier on what this is:

In some cases it seems like adding

  "htmlWhitespaceSensitivity": "ignore"

to the rules can fix some of the issues, but not all. Sometimes manually moving things around to new lines can resolve the weird formatting.