Sublime Forum

ST2: Help creating a new syntax definition

#1

I noticed there isn’t a New Syntax menu option like there is for snippets, build systems, etc. Is there any documentation around creating new syntax files for ST2?

The documentation at http://sublimetext.info/docs/en/extensibility/syntaxdefs.html appears to only apply to ST1.

Is there a Sublime JSON format for syntax files or is the only method to just create a TM language file directly?

0 Likes

#2

Ultimately the file must be XML. That plugin you linked to will convert a JSON file to XML, so it may be nicer to use, but I haven’t tried it out.
In general, because ST2 can use TextMate grammars, if you’re using some language that other people have used you can usually just use a TM grammar that someone has already made instead of rolling your own.

0 Likes

#3

[quote=“digiduck”]I noticed there isn’t a New Syntax menu option like there is for snippets, build systems, etc. Is there any documentation around creating new syntax files for ST2?

Is there a Sublime JSON format for syntax files or is the only method to just create a TM language file directly?[/quote]

You can write syntax files directly using XML. TextMate uses plist format in its editor, but on disk the files are actually XML. Once you get used to it, it isn’t that hard to work directly with the XML.

0 Likes