HURL Syntax Highlighting

Back

2023-04-12

HURL is a great tool for testing webservices. I wanted some syntax highlighting for editing hurl files in Intellij, and luckily there's a simple approach if you don't want to write a whole lexer etc. for a plugin: you can add a custom file type.

In the gui go to Settings | Editor | File Types or you can place the following content in a file called Hurl.xml in the idea.config.path (see here to find that for your platform).

On Mac it's ~/Library/Application Support/JetBrains/IntelliJIdea2023.1


            
<filetype binary="false" default_extension="hurl" description="Hurl" name="Hurl">
  <highlighting>
    <options>
      <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="" />
    </options>
    <keywords keywords="CONNECT;DELETE;GET;HEAD;LINK;LOCK;OPTIONS;PATCH;POST;PROPFIND;PURGE;PUT;TRACE;UNLINK;UNLOCK;VIEW" ignore_case="false" />
    <keywords2 keywords="HTTP;HTTP/1.0;HTTP/1.1;HTTP/2;[Asserts];[BasicAuth];[Captures];[Cookies];[FormParams];[QueryStringParams]" />
    <keywords3 keywords="body;bytes;cookie;duration;header;jsonpath;md5;regex;sha256;status;url;variable;xpath" />
    <keywords4 keywords="!=;&lt;;&lt;=;==;&gt;;&gt;=;contains;endsWith;equals;exists;greaterThan;greaterThanOrEquals;includes;isBoolean;isCollection;isFloat;isInteger;isString;lessThan;lessThanOrEquals;matches;notEquals;startsWith" />
  </highlighting>
  <extensionMap>
    <mapping ext="hurl" />
  </extensionMap>
</filetype>
                
}