Adding a DRL FileType with Syntax Highlighting to IntelliJ

IntelliJ’s support of JBoss-rules in no way compares to Eclipse, but even that isn’t enough to get me off my butt and move from my fave. That said, I created a semi-literate FileType for the drl files so that IntelliJ will recognize them and you will get a decent amount of syntax highlighting. Is it perfect?


But it will probably get you home. Here’s what you do. Create a new filetype and make sure that it includes ?*.drl files. Once that is created, it makes a filetype with the name you gave it in the


directory (at least that’s what it looks like on my Mac – I haven’t touched a windows box in years, but it should have some parallels.

Open the XML file and replace anything between the <filetype> nodes with:

<option name=”LINE_COMMENT” value=”#” />
<option name=”COMMENT_START” value=”/*” />
<option name=”COMMENT_END” value=”*/” />
<option name=”HEX_PREFIX” value=”” />
<option name=”NUM_POSTFIXES” value=”” />
<option name=”HAS_BRACES” value=”true” />
<option name=”HAS_BRACKETS” value=”true” />
<option name=”HAS_PARENS” value=”true” />
<keywords ignore_case=”false”>
<keyword name=”agenda-group” />
<keyword name=”assert” />
<keyword name=”auto-focus” />
<keyword name=”duration” />
<keyword name=”eval” />
<keyword name=”function” />
<keyword name=”import” />
<keyword name=”modify” />
<keyword name=”new” />
<keyword name=”no-loop” />
<keyword name=”package” />
<keyword name=”query” />
<keyword name=”retract” />
<keyword name=”return” />
<keyword name=”rule” />
<keyword name=”salience” />
<keyword name=”end” />
<keyword name=”exists” />
<keyword name=”false” />
<keyword name=”not” />
<keyword name=”or” />
<keyword name=”then” />
<keyword name=”true” />
<keyword name=”when” />
<keyword name=”!=” />
<keyword name=”*” />
<keyword name=”->” />
<keyword name=”:” />
<keyword name=”<” />
<keyword name=”<=” />
<keyword name=”=” />
<keyword name=”==” />
<keyword name=”>” />
<keyword name=”>=” />
<keyword name=”contains” />
<keyword name=”excludes” />
<keyword name=”matches” />
<keyword name=”Double” />
<keyword name=”Integer” />
<keyword name=”String” />

This should get you home. If you have a better one or more highlighting ideas, feel free to drop me note.


5 thoughts on “Adding a DRL FileType with Syntax Highlighting to IntelliJ

  1. I had a few problem using your file, but this one also works with IntelliJ Idea 8:

  2. Thanks for this. Huge help to me. It would be wonderful if someone would build a small compliation and error reporting plugin. 🙂


  3. In my previous comment the content of the file was missing, so here it is. This also works in IDEA 9

  4. No, it seems that XML is not allowed in the comments.
    Sorry about that


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s