Import a TextMate Bundle

There is a tool that will take an existing tmlanguage file and do its best to convert it into Javascript for Ace to consume. Here's what you need to get started:

  1. In the Ace repository, navigate to the tools folder.
  2. Run npm install to install required dependencies.
  3. Run node tmlanguage.js <path_to_tmlanguage_file>; for example, node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage

Two files are created and placed in 'lib/ace/mode': one for the language mode, and one for the set of highlight rules.

A Note on Accuracy

Your '.tmlanguage' file will then be converted to the best of the converter’s ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example:

The use of regular expression lookbehinds

This is a concept that JavaScript simply does not have and needs to be faked

Deciding which state to transition to

While the tool does create new states correctly, it labels them with generic terms like state_2, state_10, etc.

Extending modes

Many modes say something like include source.c, to mean, “add all the rules in C highlighting.” That syntax does not make sense to Ace or this tool (though of course you can extending existing highlighters).

Rule preference order

Gathering keywords

Most likely, you’ll need to take keywords from your language file and run them through createKeywordMapper()

However, the tool is an excellent way to get a quick start, if you already possess a tmlanguage file for you language.