-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode liquid format on save adds new tabs #96
Comments
Hey @itszoose this is because you have a newline in the attribute value at <img srcset="
{% if x %} foo {% endif %}" Is going to re-indent upon every save. Though Shopify does this type in theme like Dawn, it is typically bad practice. The good news is that I actually addressed such an issue in Prettify (https://github.com/panoply/prettify/issues/9) but the bad news it will not be supported any time soon. The workaround for the time being is use {% capture lazy_srcset %}
<!-- add the srcset value here -->
{% endcapture %}
<img srcset="{{ lazy_srcset }}"> and typically, just avoid applying newlines in attribute values. Hope it helps. |
That's unfortunate, so there is actually no way to fix this, perhaps there is a particular formatting rule? I am using Alpine js, and sometimes need to write extended js code and having to put many js statements in one line is unreadable at all. Thank you for your time, and for putting this amazing extension. |
@itszoose I understand how frustrating it can be but in this version there is nothing at this present moment that can be applied to fix it because it was not developed to support such structures as that you'd employ with Alpine. The pre-release of Prettify will not support Alpine structures but I will work to bring support for it. If you can share with me a code sample, (for example the code in your screenshot), I will see if there is something that can be done with what is available at present. |
🚢 Shipped v3.0.0 |
Hey @panoply Sorry, I totally missed your reply. This bug had me switching from vscode to webstorm for the past couple of months now and unfortunately, it appears that it's still not patched. As for the code sample, please use this, it should produce the same issue. <div x-data="
foo: 'bar'
">
</div> |
Hi,
Whenever I save a liquid file, on certain lines it is adding multiple tabs, on the attached video it's doing to the image tag, I have disabled prettier for .liquid files so vscode is only using vscode liquid for formatting code.
Any idea why it's doing this?
Screen.Recording.2022-07-24.at.3.54.19.PM.mov
These are .liquidrc settings
These are .prettierignore settings
These are my vscode settings:
My issue is quite similar to this one on stackoverflow, the only difference being is that his issue was prettier related, whereas in my case prettier is disabled for .liquid files.
The text was updated successfully, but these errors were encountered: