Search code examples
intellij-ideaintellij-pluginintellij-13

Intellij plugin to recognize javascript in a tag


I am using a template library that our company has developed.

It is really great, however, we are using a tag:

<g:js> 

// javascript code

</g:js> 

This tag does some stuff but essentially that is javascript code with some objects passed to it at the client.

How can I get intellij to recognize this as javascript code? Right not it is being treated as plain text.


Solution

  • You have to Inject language. To do that, move the cursor inside the tags (where your JS code is) and either:

    • Alt+Enter -> Inject Language -> JavaScript
    • Ctrl+Shift+A and type Inject language

    After that you can customize injection settings using language injection settings (again, by using one of those methods).