vscode-liquid
vscode-liquid copied to clipboard
assign variables breaks into new lines (question)
Hi! I was wondering how can I get a better format:
I have this messed piece of code (before format)
Messed pieced of code
{% assign currentInsurableItems = policy.detail.insurableItems | where:
'versionInfo.versionNumber', policy.versionInfo.versionNumber | where:
'itemType', 'vehicle' %} {% if currentInsurableItems %}
<div>
<table class="esignAutoAppTable" data-testid="coverages-table">
<tbody>
{% for currentItem in currentInsurableItems %} {% assign usState =
policy.detail.usState %} {% assign umLabel = 'UM' %} {% assign biLimit =
nil %} {% assign pdLimit = nil %} {% assign umpdLimit = nil %} {% assign
umpdValue = nil %} {% assign collLimit = nil %} {% assign compLimit = nil
%} {% assign mpLimit = nil %} {% assign raLimit = 'Not Included' %} {%
assign atLimit = nil %} {% assign uimpdLimit = nil %} {% assign umLimit =
nil %} {% assign uiumLimit = nil %} {% endfor %}
</tbody>
</table>
</div>
{% endif %}
current outcomes (formatted)
{% assign currentInsurableItems = policy.detail.insurableItems | where:
'versionInfo.versionNumber', policy.versionInfo.versionNumber | where:
'itemType', 'vehicle' %}
{% if currentInsurableItems %}
<div>
<table class="esignAutoAppTable" data-testid="coverages-table">
<tbody>
{% for currentItem in currentInsurableItems %}
{% assign usState =
policy.detail.usState %}
{% assign umLabel = 'UM' %}
{% assign biLimit =
nil %}
{% assign pdLimit = nil %}
{% assign umpdLimit = nil %}
{% assign
umpdValue = nil %}
{% assign collLimit = nil %}
{% assign compLimit = nil
%}
{% assign mpLimit = nil %}
{% assign raLimit = 'Not Included' %}
{%
assign atLimit = nil %}
{% assign uimpdLimit = nil %}
{% assign umLimit =
nil %}
{% assign uiumLimit = nil %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
expected outcomes (desired)
(all assign statements in one line)
{% assign currentInsurableItems = policy.detail.insurableItems | where:
'versionInfo.versionNumber', policy.versionInfo.versionNumber | where:
'itemType', 'vehicle' %}
{% if currentInsurableItems %}
<div>
<table class="esignAutoAppTable" data-testid="coverages-table">
<tbody>
{% for currentItem in currentInsurableItems %}
{% assign usState = policy.detail.usState %}
{% assign umLabel = 'UM' %}
{% assign biLimit =nil %}
{% assign pdLimit = nil %}
{% assign umpdLimit = nil %}
{% assign umpdValue = nil %}
{% assign collLimit = nil %}
{% assign compLimit = nil %}
{% assign mpLimit = nil %}
{% assign raLimit = 'Not Included' %}
{% assign atLimit = nil %}
{% assign uimpdLimit = nil %}
{% assign umLimit = nil %}
{% assign uiumLimit = nil %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
how could I get this kind of formatting?
Hey @mau2099 this is likely a defect. You can adjust it manually after initial format.
Hey @mau2099 this is likely a defect. You can adjust it manually after initial format.
thanks for your answer! do you mean it's a defect in the original prettydiff tool? Or am I doing something wrong in the code? do you have an expected date to release your tool Liquify?
Thank you a lot!
do you mean it's a defect in the original prettydiff tool? Or am I doing something wrong in the code?
So likely an issue with PrettyDiff the current version of this extension is using or something internally happening when the code is being formatted, I would need to run tests to see where it actually happening, nothing wrong with your code though.
In Liquify, the formatting logic was completely overhauled and it uses a hard-froked variation of PrettyDiff which addresses all these issues. That project is called Prettify so I will likely upstream the defect in that project.
do you have an expected date to release your tool Liquify?
In the past I have failed to come through on release dates (like, I am really bad at keeping to deadlines with this tool) so I try to avoid giving them because I am the only developer really working on it atm. I am aiming towards a summer release as per liquify.dev. I just need to find the time, I apologize for delays or headaches the current version is giving you.
🚢 Shipped v3.0.0