Sublime Forum

Syntax injection

#1

I’ve been working on a syntax package for Sublime Text, and realize that the only real way to get the job done is to write an injection grammar (of the kind available in TextMate since v2)

Can anyone provide or point to a simple working example of an injection grammar?

I’ve only found examples for Textmate, and they seem to not work in Sublime Text.

A simple example might be one that sets the scope of all instances of the word “illegal” to “invalid.illegal”, within files of any format? So, for example, once the injection grammar was loaded, all files (regardless of the active syntax) would see the word “illegal” highlighted?

The above example should take maybe 10 lines of code inside a .tmLanguage file… assuming injection grammars are supported in Sublime Text (I’m assuming they are since Textmate added them a year before Sublime Text 2 was released.

0 Likes

#2

(bump)

0 Likes