Best way to add highlighting for a new language?


#1

I want to add support for a new language which does not yet have an atom.io, or textmate, package.

The only information I can find on making a language package tell me to convert an existing textmate package, and there are good guides on making textmate highlighters.

Is there a guide yet to making an atom.io package for a new language directly, or should I start by creating a textmate package, and then convert that?


#2

You can get inspiration from the current language packages:


Or you can check this documentation:

https://atom.io/docs/v0.71.0/creating-a-package#language-grammars


#4

I am the author of AtLilyPond package, the Atom highlighter for the LilyPond music typesetting language. Since my original release was for SublimeText, in which grammars are written in JSON and compiled into XML, I followed the conversion avenue to produce the Atom version. The process was not perfectly straightforward, however, because the apm converter that is bundled with Atom accepts only TextMate bundles, not Sublime Text packages, as input. And even though both editors use the common .tmLanguage extension for grammar files, they use different data formats to represent a grammar: SublimeText uses JSON and XML, as I mentioned, whereas TextMate uses the obsolete “NextSTEP plist” (a pre-OS X format), which looks like but is not JSON properly speaking. Luckily, I discovered a Python script that automates the conversion from XML to “NextSTEP plist.” The script may be found at this link. It is not perfect—backslashes lost their escaping in the output somehow—but it generally works fine and is tremendously helpful.

Thereafter, with my highlighter converted into “NextSTEP plist” format and thoroughly tested on TextMate, I was able to follow the TextMate-to-Atom process described in the docs without problems.

In your case, considering that XML is extremely cumbersome to manually code in, and that learning a defunct data format such as “NextSTEP plist” would make a mediocre investment of your time, I believe you have two options:

  1. Follow the procedure I describe above (JSON for SublimeText=>Conversion to “NextSTEP plist” for TextMate=>Conversion to Atom).
  2. Write your grammar for Atom directly in CoffeeScript.

Good luck!


#5

I would like to bump this topic.

The link which was posted by @AbeEstrada is dead for now.
Is there any documentation about atom grammar format?