Skip to content

Instantly share code, notes, and snippets.

@MatthiasPortzel
Created April 13, 2019 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatthiasPortzel/b4a65aba2a40e7219db72ba787088c5e to your computer and use it in GitHub Desktop.
Save MatthiasPortzel/b4a65aba2a40e7219db72ba787088c5e to your computer and use it in GitHub Desktop.
An example of how to add syntax highlighting for new languages to xi-mac.
  1. To add, for example, TypeScript,
  2. Find a .sublime-syntax file for the language.
  3. Create a TypeScript folder in xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/
  4. Place the .sublime-syntax file in that folder.
/xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/TypeScript/TypeScript.sublime-syntax
  1. In xi-mac/xi-editor/rust/syntect-plugin/, run
cargo run --release --example make_manifest
  1. Rebuild Xi. In /xi-mac/, run xcodebuild
  2. Restart Xi.

If you don't have a .sublime-syntax file:

  1. Find a .tmLanguage file.
  2. Install a program to convert them
gem install sublime_syntax_convertor
  1. Use sublime_syntax_convertor folder

I cloned babel/babel-sublime: Syntax definitions for ES6 and JSX., and called sublime_syntax_convertor with it. And for TypeScript, used TypeScript.sublime-syntax.

Random commit that led me to finding how to run make_manifest here.

@cmyr
Copy link

cmyr commented Apr 13, 2019

You can open PRs into https://github.com/xi-editor/syntect-resources to add additional default languages to the syntect-plugin. I am 100% happy to accept syntax definitions for commonly used languages, and typescript would definitely qualify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment