Closed lauritsen closed 1 year ago
Code duplication in <script>
tags has been resolved in the following releases:
prettier-plugin-antlers
: 1.2.6
antlers-language-server
: 1.2.7
antlers-formatter
: 1.2.6
2.6.8
Hi @JohnathonKoster
Thanks for the fix!
I do experience some other funny behavior after the update.
In my simple test file, when saving it the if statement
within the script
tag get replaced by a random indentifier e.g.
<script type="application/json">
< agyfprw4kffub4a >
<
/agyfprw4kffub4a>
</script>
{{ if somethingElse }}
<script></script>
{{ /if }}
In my regular file, where I first saw the original bug, it now indents the contents and the closing tag of the script
on every format leading to excessive indentation.
I'm not unable to reproduce either issue with the latest prettier or formatter build (reformatting the same input over 100 times) 🤔
Would you be able to be able to share you prettier configuration, as well as the original file that is experiencing the excessive indentation bug (if you want to keep it private, you can email it to john@stillat.com).
Thanks!
@JohnathonKoster sorry for the radio silence... It happens to me in this file: https://github.com/studio1902/statamic-peak-seo/blob/c29efae7c2d3e5efdcb0e4a05a57d2dfa6414296/resources/views/snippets/_seo.antlers.html Lines 81-99, 107-121, 167-175 keeps getting indented on each saving of the file.
Describe the bug Code is being copied from a script tag and pasted inside an if clause.
Impacted Products Which Antlers Toolbox products does this bug apply to?
Versions and Other Plugins/Extensions
Antlers Toolbox v2.6.7 Prettier - Code formatter v10.1.0 (issue persists when I disable prettier)
settings.json
To Reproduce Create a new antlers file e.g. _test.antlers.html with the contents below
Saving the file reformats, but also duplicates code resulting in
where it for some reason copies the content of the first
<script>
tag and pastes it inside the{{ somethingElse }}
if statement.If I try to use
Alt K + F
to format, I get an error sayingAntlers Toolbox
cannot formatHTML (Statamic Antlers)
Expected behavior That it only formats the file.
If submitting a formatting bug, please include the template contents below as well as an attachment
_test.antlers.txt
Please rename to
.html
as I could not upload an html file here.