User Defined Language Injection

In IntelliJ IDEA you can quickly configure language injection for XML tags, attributes and Java method parameters and their return values. Just use Inject Language Intention on the code like this:



and it will immediately turn to:




And you get the complete coding assistance, with syntax and error highlighting, completion and navigation.

This functionality is provided by the bundled IntelliLang plugin. The full configuration is available for edit in the Settings dialog (see screenshot below). Default configuration includes various mappings like RegExp language in Pattern.compile(), SQL in JDBC API calls, JPA & Hibernate QL injections and much more.

This entry was posted in New Features and tagged . Bookmark the permalink.

4 Responses to User Defined Language Injection

  1. I just realised how powerfull this feature can be. It can enable writing libraries like closures (http://code.google.com/p/closures). Which let you using easily embeded dynamic languages like groovy or jruby inside of JVM almost seemlesly.

  2. Volker Mosthaf says:

    Is the annotations.jar only required for compilation or also during execution?
    If it is necessary at runtime, can the jar be freely distributed along with applications created by idea?

  3. How come we’ve never heard of this before? Talk of hidden gems

  4. Matthew Pocock says:

    The language injection feature is awesome. However, right now languages can only be injected into a couple of host languages (xml, java?). I work mainly in scala, and would love to be able to inject languages into strings in my scala code.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">