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

constant: No text for TestConstantExpression defined #93

Open Miras4207 opened 2 years ago

Miras4207 commented 2 years ago

It seems this plugin does handle constant function correctly.

The following example code:

{% if post.status is constant('Post::PUBLISHED') %}
    the status attribute is exactly the same as Post::PUBLISHED
{% endif %}

is incorrectly changed to:

{% if post.status is (Post::PUBLISHED) %}
    the status attribute is exactly the same as Post::PUBLISHED
{% endif %}

Prettier command outputs the following message:

TestExpression: No text for TestConstantExpression defined

Versions used: Prettier 2.5.1 prettier-plugin-twig-melody 0.4.6

Any help with this topic would be much appreciated. Thank you.