Feed on

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.

   Send article as PDF   

No Responses to “Adding a DRL FileType with Syntax Highlighting to IntelliJ”

  1. André says:

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

  2. Andrew says:

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


  3. André says:

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

  4. André says:

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


Leave a Reply

Bad Behavior has blocked 57 access attempts in the last 7 days.