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

Tag prettier-ignore not working on twig mustache #52

Open JeanLucEsser opened 4 years ago

JeanLucEsser commented 4 years ago

Maybe it's me but it looks like something like this won't work:

{# prettier-ignore #}
{% set excludeIds = alerts |group(e => e.alertRef[0].id ?? 0) |keys %}

This won't work either:

{# prettier-ignore-start #}
    {% set excludeIds = alerts |group(e => e.alertRef[0].id ?? 0) |keys %}
{# prettier-ignore-end #}

Is ignoring only possible for html tags?

[Edit] Actually after some more testing the formatting is ignored (as intended) on "format-able" lines. But the line above is not recognized because the 'group' filter is Craft specific which is why I'm trying to ignore it in the first place, so the rest of the document can be formatted without returning an error.

[More Edit] I'm still doing more testing and it looks like the error is not returned by the group filter per se but by the arrow function e => e.alertRef[0].id. So I'll update my other issue #51.