mblode / vscode-twig-language-2

VS Code extension with snippets, syntax highlighting, hover, and formatting for Twig.
https://marketplace.visualstudio.com/items?itemName=mblode.twig-language-2
MIT License
60 stars 27 forks source link

Can you please remove the complete formatting functionality #74

Open kevinmu17 opened 3 years ago

kevinmu17 commented 3 years ago

It is so broken, i know, you are using prettyDiff... They where the reason i switched from atom to vscode, bad maintained!

Your extension does a great job with highlighting and snippets which I want to keep. But the formatting I want to ommit. It seems that the config "Twig-language-2: Formatting" doesn't do it's job when turned off, it gives me a message when trying to prettify my code "Extension Twig-language-2 cannot format template" so it's still blocking in a way.

Hope you can help!

kevinmu17 commented 3 years ago

I'll dove into the problem, somehow it didn't removed the line "editor.defaultFormatter": "mblode.twig-language-2" from the settings.json. So it still called the formatter to do it's job.

I found out that the problem lies within COMMENTS. if you place comments inside a div with attributes it messed up everything. if you make a comment on only 1 line, not nested in any element, it will be fine (this should need a fix though)

samche2000 commented 3 years ago

Same problem for me with comments between blocks :

{% block body %}
   {#
      My comment between block
    #}
{% endblock body %}
{#
   My comment outside block
#}

After some "auto formatting"

{% block body %}
   {#
                                                   My comment between block
                                                 #}
{% endblock body %}
{#
   My comment outside block
#}
estebancastro commented 3 years ago

Same problem here, with the Comments, my editor.defaultFormatter is set to None

the-sides commented 3 years ago

Was about to post the same issue. This needs to be fixed as comments are impossible to format.

mattbloomfield commented 3 years ago

Same with {% set %} tags. Everything indents after them

ErnstStavroBlofeld commented 2 years ago

This formatter also ignores indentation type setting and forces you to use tabs like a caveman.

chrisvidal commented 2 years ago

+1