prettier-plugin-astro
prettier-plugin-astro copied to clipboard
🐛 BUG: Added unnecessary end tag in expression
Describe the Bug
Failure Pattern
Probably, the conditions are:
- inside expression
- 2 or more attributes
-
>is in next line
Input
<div>
{
(
<div id="id" class="class"
>text
</div>
)
}
</div>
Output
<div>
{
(
<div id="id" class="class"></div>
text
</div>
)
}
</div>
added unnecessary </div> .
Success Patterns
the line ends with >
Input
<div>
{
(
<div id="id" class="class">
text</div>
)
}
</div>
Output
<div>
{
(
<div id="id" class="class">
text
</div>
)
}
</div>
outside expression
Input
<div>
<div id="id" class="class"
>text
</div>
</div>
Output
<div>
<div id="id" class="class">text</div>
</div>
with single attribute
Input
<div>
{
(
<div class="class"
>text
</div>
)
}
</div>
Output
<div>
{(<div class="class">text</div>)}
</div>
Notes
- I'm using prettier-plugin-astro via astro-vscode v0.24.4.
- my
printWidthsetting is120.
Steps to Reproduce
See Describe the Bug
Hello, it seems like this is not a bug in the Prettier plugin, but in VS Code's auto closing. Setting html.autoClosingTags to false fixes the issue (but, of course disable tags auto closing).
Not sure if there's way on our end to fix it, I'll investigate
The auto closing logic in the extension has been upgraded and it seems like this is not an issue anymore, as such I'll close this issue