Not seeing how to get PHPStorm to automatically add Twig end tags

Whenever I type something like `{%`, a closing brace like `%}` is added, and the typing caret is placed in-between (completely what I want); however, if I then fill the empty tag with an expression like `if whatever` or `for whatever in something`, going to the end of the line and hitting newline doesn't add a matching closing tag, like `{% endif %}` or `{% endfor %}` etc.

I'm not seeing anywhere in Preferences to make this happen.

Since I have to type out the closing tag myself, this means I often absent-mindedly hit Tab on the next line to indent, type my inner-block code, then when I hit newline again and add the closing tag, it stays indented, and I have to de-indent it; otherwise, I have to type the end-tag before indent, which then means I have to hit up-arrow then go to end of line then hit newline to get a new empty indented line for the inner-block logic...

Can you see how this is a lot of nonsense work that PHPStorm already alleviates in other languages like PHP and and HTML and JavaScript with closing end tags or closing braces etc?! Why is this ignored in Twig? Twig has a very sensible structure for this.

3 comments
Comment actions Permalink

There is a feature request for an automatic end block completion:
https://youtrack.jetbrains.com/issue/WI-19615/Provide-completion-for-endblock-tag

The ticket seems to be unpopular and abandon, so I will leave an internal comment with the link to this thread to draw some attention to it.

0
Comment actions Permalink

It seems to be unpopular or abandoned because there's confusion on who would actually implement the feature...

Are you seeing who would actually make the change?

It seems PHPStorm devs are saying it's a plugin-maker's job, but the plugin maker seems to be saying it's PHPStorm dev's job... I'm a little confused on the situation.

0
Comment actions Permalink

At this moment, it is a separate plugin maintained by JetBrains:
https://plugins.jetbrains.com/plugin/7303-twig

0

Please sign in to leave a comment.