I know this thread is old, but it’s come up as the top hit in web searches periodically over the past year, so I figured I’d post a reply here.
I configured a user-defined language for HCL - at least a fledgling one - based on the documentation references that @PeterJones cites in the second post in this thread, as well as a cursory review of the HCL language spec. The relevant configuration is posted below, with the following caveats:
I barely know HCL, this is my first Notepad++ UDL, and I’ve only spent about 2 hours on this so far, so set your expectations accordingly
I’m posting this draft UDL in case it might help others get started, but…
I’m not planning to maintain this as a project, so please don’t request fixes/enhancements
I defined the new language using the Notepad++ 8.1.9.1 Language > User Defined Language > Define your language dialog
Accordingly, the configuration below was persisted in my %APPDATA%\Notepad++\userDefineLang.xml file
Another thread I read said that this is the old way of storing UDLs (the new way being the userDefinedLang directory) but the doc states that this is the method the configurator dialog uses, so voila
I’m using dark mode with some global overrides, so you may need to change the colors just to make them readable if you’re using a light-colored background
Two limits of which I’m aware are:
Folding doesn’t work. This seems to be due to the fact that I’ve defined curly braces as the folding delimiter, but also as operators and in another delimiter (I can’t explain it better than that at the moment).
Heredocs aren’t formatted specially, like you get with the built-in “shell” language, for example. I think that UDL just doesn’t support heredocs - but it’s equally likely that I just don’t know how to do it.
You should be able to add the following to your userDefineLang.xml file (creating the file, if necessary) and restart Notepad++. Once you do, you should see a new “HCL” choice at the bottom of the Language menu (note that this won’t show up under the “H” sub-menu along with the built-in languages):
npp_hcl.jpg
Here’s the content of my userDefineLang.xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
<UserLang name="HCL" ext="tf" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 00// 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
<Keywords name="Numbers, extras1"></Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2"></Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">+ - * / % && || ! == != < > <= >= : ? { } = => [ ] ( ) . , ... ${ %{ ~</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open">{</Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close">}</Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">data default dynamic locals module output provider resource terraform variable</Keywords>
<Keywords name="Keywords2">false null true</Keywords>
<Keywords name="Keywords3">else endfor endif for if in</Keywords>
<Keywords name="Keywords4">abs abspath alltrue anytrue base64decode base64encode base64gzip base64sha256 base64sha512 basename bcrypt can ceil chomp chunklist cidrhost cidrnetmask cidrsubnet cidrsubnets coalesce coalescelist compact concat contains csvdecode defaults dirname distinct element file filebase64 filebase64sha256 filebase64sha512 fileexists filemd5 fileset filesha1 filesha256 filesha512 flatten floor format formatdate formatlist indent index join jsondecode jsonencode keys length list log lookup lower map matchkeys max md5 merge min nonsensitive one parseint pathexpand pow range regex regexall replace reverse rsadecrypt sensitive setintersection setproduct setsubtract setunion sha1 sha256 sha512 signum slice sort split strrev substr sum templatefile textdecodebase64 textencodebase64 timeadd timestamp title tobool tolist tomap tonumber toset tostring transpose trim trimprefix trimspace trimsuffix try upper urlencode uuid uuidv5 values yamldecode yamlencode zipmap</Keywords>
<Keywords name="Keywords5"></Keywords>
<Keywords name="Keywords6"></Keywords>
<Keywords name="Keywords7"></Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00${ 00%{ 01$${ 01%%[ 02} 02} 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21' 21" 22\ 22\ 23' 23"</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="808080" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008040" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="FF00FF" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="FFFF00" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="00FFFF" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="8080FF" bgColor="FFFFFF" fontStyle="0" nesting="16781440" />
<WordsStyle name="DELIMITERS2" fgColor="FF0080" bgColor="FFFFFF" fontStyle="0" nesting="128" />
<WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="FF0000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="808080" bgColor="FFFFFF" fontStyle="0" nesting="1" />
</Styles>
</UserLang>
</NotepadPlus>
Thanks to Ivan Radić for his excellent UDL 2.1 documentation; I wouldn’t have made it this far without it.