vscode-liquid
vscode-liquid copied to clipboard
Formatting Overridden by Prettier
If you use Prettier, its HTML formatting trumps this plugin and makes a huge hot mess. There is a workaround which is that you can set your workspace settings along the lines of
{
"settings": {
"editor.formatOnSave": true,
"[html]": {
"editor.defaultFormatter": "sissel.shopify-liquid"
}
}
}
Which will force this plugin to be the default formatter for HTML language files. Obviously that'll apply to filetypes other than .liquid, which isn't ideal but most likely fine for a Jekyll/Shopify project. Perhaps it could be built-in as an option, to this plugin? Might not be possible. Either way this issue could be closed and stay here to help anyone with the same problem.
PS: Fantastic plugin, thank you @panoply ! The "Generate a .liquidrc file" feature is genius.
Thanks for this, it's much appreciated.
In next release (v2.4.0) you will be able to define formatting by file extension with HTML (.html) files needed to be included manually – this will help prevent these types of conflicts occurring. By default in v2.4.0 the following extensions will have formatting automatically applied.
Do you have any other suggestions or feature requests that might be helpful?
That looks like a perfect solution, @panoply nice one!
Only one possible feature request that comes to mind.. I'd like for it to convert {{foo.bar}} to {{ foo.bar }}, as is the recommended syntax. Perhaps {{ foo|asset_url }} to {{ foo | asset_url }} and that kind of thing.
It'd be handy to fix all the crazy inconsistencies in peoples' code. Other than that, it's exactly what we need!
Can you create another issue for this? @entozoon
Is this still a workable solution? I can't figure out how to install the correct plugin to allow prettier to process my html files with liquid.