prettier-plugin-twig-melody icon indicating copy to clipboard operation
prettier-plugin-twig-melody copied to clipboard

Support for ??? "Empty Coalesce" operator

Open kylecotter opened this issue 4 years ago • 1 comments

Hi,

I'm using this with Craft CMS Twig templating and am curious how I'd go about circumventing a syntax error with the ??? operator.

I use this plugin, which it itself is based on a PR pending on the Twig repo, quite a bit.

When compiling with Prettier I get Error: ERROR: Unexpected token "?" of value "?" which occurs as an example, within a conditional such as {% if foo ??? bar %}

Obviously, it's right to throw an error as it isn't official Twig markup, but was wondering if there was a way to get past that.

Thanks a bunch for your work on this!

kylecotter avatar May 02 '20 19:05 kylecotter

Hey, have you found a good solution? I only found out that I could use <!-- {% set id = element.myId ??? null %} --> around it to get past it, but these results in a lot of <!-- --> comments on page 🤔

mandrasch avatar Jun 29 '23 10:06 mandrasch