User Defined Language Injection
March 20th, 2009 by Gregory ShragoIn 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.
Tags: Language Injection

June 16th, 2009 at 3:06 pm
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.
September 10th, 2009 at 6:54 am
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?
September 2nd, 2010 at 6:17 pm
How come we’ve never heard of this before? Talk of hidden gems
November 2nd, 2010 at 7:35 am
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.