At Atlassian, we’ve been on the Google Gadgets gravy train for the past few months. Working with gadgets means you’ll be working a lot with HTML & JavaScript stuck in XML files. Since the IDE picks up the file as an XML file, you end up losing the syntax highlight sugar coating you know and love.

Luckily, for IDEA users in any case, there is a way! With IntelliLang you can “inject” a language within another language. You can configure IDEA to recognise text of <Content> tags in XML files as HTML. Simply hit “Command + 1” (quick fix) in the content block, select “Inject Language”, choose HTML and you’re done. You can tweak the configuration (e.g. you accidentally selected JavaScript rather than HTML) through the “Settings” menu.

Now you should have full HTML, CSS & JavaScript recognised by IDEA in your little Content block. IDEA seems to take a second or so reparsing the file, but you do get the usual autocomplete, highlighting goodness.

Syntax Highlighting for Google Gadgets