wearedestination / prettier-plugin-twig

Prettier Twig/HTML plugin
MIT License
6 stars 1 forks source link

Quotes Refactoring #5

Open TomoyaHamasaki opened 5 months ago

TomoyaHamasaki commented 5 months ago

Any lead where I can add single quotes for twig tags like {{ stimulus_controller('controller-name') }} and then make double quotes for html elements or anything not twig use? Like... <div class="class name">

So you would have

{{ stimulus_controller('controller-name') }}
<div class="class name">

This would be amazing if we can get this in.

andyexeter commented 3 months ago

I had thought setting the liquidSingleQuote to true would do this but it doesn't seem to work.

I've noticed in my testing that setting this option does correctly format the following:

{% form "test" %}{% endform %}
{{ "test" }}

So we probably need to look at modifying how liquidSingleQuote works and make it aware of functions and Twig blocks.