With sponge going with HOCON for its config I decided to try it out my self to get use to it. I like it alot over json or ymal however there is one thing I am wondering about.
What txt editor is good to edit its syntax. Notepad ++ supported .yml in a way that it provided buttons on the side that allowed you to collapse blocks of config to hide away what you don’t need to see at the time. However .json and the file extension .conf HOCON shows to use in examples doesn’t appear to have the same utility in notepad++. Visual studio has utility for .json but shows warnings whenever I use the less strict syntax of HOCON using the .json extension, and none when I use the .conf extension.
Is there a text editor that provides utility for HOCON?
There you go, I looked it up and no one has even written the rules out as a language format for it, so someone here could do that. Under languages press “Define your language” then copy the language definition file and post it here.
To clarify what @tebbenjo means, Notepad++ comes with built-in ‘definitions’ which can tell N++ that something is part of a language’s syntax. N++ then allows you to color those terms and syntax details.
As I believe that HOCON was create for Forge, it’s not too surprising it doesn’t have a definition yet. You can define your own language by going to the Language menu in the N++ toolbar and clicking the next to last option “Define your language…”, if anyone is interested in doing so. Some info about HOCON (Not sure how reliable it is, but it looks like a good document)
The HOCON language is derived from JSON, so I’ve read, so maybe starting by importing the JSON definitions would be a good start. N++ may also provide some partial coloring or recognition for HOCON if you set the language to JSON (also done via the Language menu)
Ah, thanks for clarifying that. I thought I read elsewhere on the forums it was designed for Forge. Guess it could’ve said something along the lines of Forge using it’s own config file type and nothing about HOCON, but I’ve no idea anymore.
HOCON is a subset of JSON so for syntax highlighting the JSON support should be sufficient in most cases. I cannot speak for Notepad++, but most of the well known texteditors such as GitHub’s Atom, SublimeText and Textmate support JSON natively. Additionally all of this editors can be easily extended with custom packages so writing a dedicated HOCON support - if that is really needed - is quit simple.
As for terminal editors, for nano users this repository provides a starting point.
The documentation I linked a few posts up specifically note that HOCON isn’t a subset of JSON, but is only derived from it (I’m not sure how that particularly works or why, just something I noticed), and I would think N++ has JSON support at least. Since the language definitions are generally just lists of keywords or regex patterns (I think), I was thinking it’d also highlight some stuff decently if set to JSON.
Right, my bad. JSON is a subset of HOCON, not the other way around (all JSON is valid HOCON but not all HOCON is valid JSON). That means that also my initial assumption was wrong and a dedicated parser is need. Luckily this can be done quit easily for the editors I mentioned.
Ah your right, that works out nicely. Still would be nice for a dedicated one for HOCON due to javascript keywords highlighting and the lack of HOCON keywords such as its “include” keyword, but it works
So for an editor I have a 2 options (that I know of):
Option 1: Go for paid but shareware program: [Sublime Text 2][1] (version 3 coming soon) is a very VERY good editor. Fact is its not Open Source but the shareware version is totally usable (just says you can pay when you save a file from time to time). The fact is there is a [module][2] for HOCON and if it is not good we can definitely build one.
Option 2: Go for the Open Source alternative: [Atom][3] is amazing! The fact is its 100% hackable but I have not found a plugin/module for HOCON so I would be glad to make one for the community.