Syntax Highlighting in Github's Atom

I know there’s an Designer but, well, I just don’t love it. I do however love Openhab…and Github’s Atom. I found the page talking about thirdparty text editors, but alas Atom wasn’t one of them and I couldn’t figure out how to import the sample XMLs into Atom. Has anybody gotten Atom to properly highlight the syntax of Openhab?

I’ve done it way back when for vim. Ultimately I stuck with Designer primarily because it does so much more than just syntax highlighting including:

  • syntax checking to include Actions and Items defined in the .items files
  • “intellisence” through <ctrl>c

I’m not saying that other editors can’t do this. But for me it was going to be way more work than is worth it to me to make it work.

Atom looks very customizable (reminds me of good old EMACS actually, only with less Lisp) and I could see it being a good candidate for an alternative editor, assuming someone spends the time to do more than just syntax highlighting with it.

1 Like

@rlkoshak Thanks again for the response. Clearly all of this would be beyond me and, though it would be great, obviously I’ll be using the Designer for the foreseeable future:) If any kind, much smarter, soul decides to throw something together, I would be very excited to try it out:)

If you just want some basic syntax highlighting in Atom, you can use the language-xtend plugin - I haven’t looked into it, but I would expect that it should you readily customise it to openHAB’s DSL.

1 Like

@smar thanks for the suggestion! The documentation on that is a little light but I’ll give it a shot. What is the basic principle? Do I define things through an xml file or something?

It’s actually JSON if I recall correctly. If you look in your .atom/packages/language-xtend folder (once you’ve installed the language), you should see a grammars folder containing the xtend.json file.

Also have a search in the Atom forums for info on how to customise languages (you need to search on the keyword ‘grammars’ etc), e.g.

1 Like

@smar thank you!

Owwww I’d like this!!!

@jmccoy555 haha yeah.

So I’ve spent a little bit of time looking into how to convert the various options available on github (VIM, TextMate MCedit etc) into the json needed by the xtend package for Atom. Frankly, its still a bit beyond me and the cost of doing it is now FAR outweighed by the benefits of it. If someone has already thrown together an appropriate JSON, I’d be more than happy to test, but that’s about all I’m gonna be able to contribute.