How to make Language Injection for custom twig tag

Hello,

In my project for templates i uses Twig engine, and for javascript purposes i create custom {% script %} tag.
Does it possible to create Javascript language injection for that tag:

template.twig:
---------------------------------------------

... some html code...

{% script %}

... javascript code here ...

{% endscript %}

---------------------------------------------

Need phpStorm to highlight javascript syntax inside the {% script %} tag.
I tried to create XML tag Injection with Value Pattern "\{% script %\}(.*)\{% endscript %\}", but it works only if the {% script %} tag placed inside some xml <tag>. In my *.twig files {% script %} tag doesn't surrounded by anything.

Is there any suggestions how to make such language injection?

1 comment
Comment actions Permalink

Hi there,

I do not think it's possible without special support from IDE side.

Is there any suggestions how to make such language injection?

Please submit Feature Request to the Issue Tracker .

Recently such feature was implemented for Smarty templates ( http://youtrack.jetbrains.com/issue/WI-10478 ) .. so I do not see why this cannot be done for twig as well (unless current implementation will also work with twig files .. which I doubt).

P.S.
Possibly this is the right ticket (not 100% sure) -- http://youtrack.jetbrains.com/issue/WI-11277

0

Please sign in to leave a comment.