Closed christian10xinnovation closed 4 months ago
Hey @christian10xinnovation
So this is rule related and it works in a 2 iteration cycle, meaning If you were to hit cmd + s a second time (or rerun the formatting command) it will restructure itself to position the comma ,
characters to be placed before the parameters, for example:
Before
{% render 'product-image',
param_1: object.prop1,
param_2: object.foo
%}
After
{% render 'product-image'
, param_1: object.prop1
, param_2: object.foo
%}
If you prefer comma character to be place after parameter expressions as per your screenshot, You can adjust the position placement of comma characters using the Liquid lineBreakSeparator
formatting rule. You can change that setting in either your .liquidrc
file or your workspace settings:
If you are using a .liquidrc
file you can adjust the formatting setting as follows:
{
"format": {
"liquid": {
"lineBreakSeparator": "after" // set this to after
}
}
}
If you are using Workspace settings, you can adjust the formatting setting as follows:
{
"liquid.format.rules": {
"liquid": {
"lineBreakSeparator": "after" // set this to after
}
}
}
You can find information for the formatting rule in the Æsthetic documentation here: https://aesthetic.js.org/rules/liquid/lineBreakSeparator/
Awesome, this is exactly what I was looking for. Didn't find the documentation before (probably not looked hard enough), so thanks a lot for linking it and thanks for developing this extension!
Hey everyone, New here and this is my first issue post :) Been struggling to get the indentation of these lines of code right. Not sure if this is my own fault or if it's an issue. Anyway, maybe someone can help, thanks in advance! Before:
After:
![image](https://github.com/panoply/vscode-liquid/assets/146930112/f5c477c6-97b8-4903-b93f-f3129ecad221)