trivago / prettier-plugin-twig-melody

Code formatting plugin for Prettier which can handle Twig/Melody templates
Apache License 2.0
155 stars 35 forks source link

same as with string inside if fails #73

Open galatea-nl opened 3 years ago

galatea-nl commented 3 years ago

When using same as with a string, it gets rewritten wrong:

{% if a is same as('b') %} {% endif %}

will become:

{% if a is same as(b) %} {% endif %}

(note the missing quote around b

When not inside an if statement it works as expected:

{{ a is same as('b') ? 'foo' : 'bar' }}
oradwell commented 3 years ago

I have the same issue. Used the following as a workaround:

{% if a == 'b' %}
{% endif %}