Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Importing .tmtheme and .tmlanguage Files into Ace
ACE supports the importing of .tmtheme and .tmlanguage files for use in the editor. The task is accomplished by two simple node scripts.
Importing Textmate/Sublime Themes
- Go to the tool folder, and run
npm installto install required dependencies.
- Drop your .tmtheme file into the tmthemes folder.
- Update the tmtheme.js file to include your new theme.
Your .tmtheme will be converted and placed into lib/ace/theme
alongside other themes. Note that there’s one more class we’ve added
that isn’t available in regular Textmate themes, and that’s for
.ace_indent-guide. This class adds indentation guides for your theme,
using a base64-encoded png. In general, the dark themes and light themes
each have their own strings, so you can just copy the class from an
Importing Textmate/Sublime Languages
If you’re interested in porting over an existing .tmlanguage file into Ace’s mode syntax highlighting, there’s a tool to accomplish that, too.
npm installat the root ace folder to install required dependencies.
- Go to the tool folder.
- Drop your .tmlanguage file into the tool folder.
node tmlanguage.js <path_to_tmlanguage_file>, such as
node tmlanguage.js MyGreatLanguage.tmlanguage.
- Deciding which state to transition to
While the tool does create new states correctly, it labels them with generic terms like
- 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
- Rule preference order
- Gathering keywords
Most likely, you’ll need to take keywords from your language file and run them through
Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into kitchen_sink.html and demo.js, as well as write any tests for the highlighting.