Reputation: 7107
In IDEA, when editing a HTML file, the text content of <script>
elements will be treated differently by the IDE according to the type
attribute. For example, the text content of a <script type="text/javascript">
element is treated as Javascript and highlighted as such; similar for <script type="text/css">
and CSS, <script type="application/json">
and JSON, and others.
How can I configure a custom <script type="...">
language association?
Specifically, I want IDEA to treat the text content of script elements of type "x-shader/x-fragment"
as GLSL. I have a GLSL language plugin installed, but it only highlights .glsl
files. I am using IntelliJ IDEA 14.0.3.
NB: There is no Inject Language/Reference option for the content of <script>
elements, unlike other HTML elements.
Upvotes: 2
Views: 812
Reputation: 2523
Yole's answer is probably the best for your use case, but I actually ran into a similar issue where Intellij wasn't treating "text/babel" as "text/jsx" like I wanted.
If you don't mind moving the content of your script to another file, you could do something like this:
<script type="x-shader/x-fragment" src="your_script.glsl"></script>
Then of course you'd get the proper syntax highlighting when you edit the file.
Upvotes: 1