Closed schellenbergk closed 3 years ago
You're probably using prettier as your code formatter and that is causing the issue. a quick workaround is to add prettier-ignore
comment before your schema.
{%- comment -%}<!-- prettier-ignore -->{%- endcomment -%}
{% schema %}
{
...
}
{% endschema %}
or the better alternative is to install the Liquid extension and set that as your code formatter.
I'm also using VS Code and don't have any problems. Most likely some formatter, like already mentioned, is causing the issue.
Hmmm, none of that helped. But I noticed by default when opening .liquid
files the language mode detected is set to HTML
not liquid
, when I switched to liquid
language (manually) then saving did not trigger auto format. Format only worked properly when I run Liquid: Format Document
command.
Is there a way to fix language detection in VSCode for liquid files and make the format on save
work with it too?
I was able to fix the first issue with:
{
"files.associations": {
"*.liquid": "liquid"
}
}
but the format on save
is still an issue.
Just found a fix here: https://github.com/panoply/vscode-liquid/issues/32#issuecomment-748382665 that worked for me
Version and operating system
Description
VSCode collapses all spaces in a liquid file schema on save.
Additional Details
https://gifyu.com/image/D6wN
What is Expected?
Properly formatted a Schema
What is actually happening?
All spaces/new line characters removed