2

I'm writing a language definition for sublime text for the Kinetic Rule Language. In KRL, there are some places where you can write HTML or Javascript, so I want to let the Javascript and HTML language definitions take over for these blocks.

I thought it would be as simple as just specifying text.html or source.js for the scope name, but that doesn't seem to work. Can anyone shed some light on the proper way to do this?

1 Answer 1

2

If you define the regions in which HTML or javascript will be defined, you can define a start and end regular expressions, and include the language. It's described a little more in Sublime Text 2: Different language highlighting based on context? (a la Webstorm).

If instead you want to include it globally (for instance if you were simply extending the language), you can add the following as an entry under "patterns".

<dict>
    <key>include</key>
    <string>source.js</string>
</dict>
<dict>
    <key>include</key>
    <string>text.html</string>
</dict>
1
  • You're right, it needs to be include'd, not used as the scope name. Thanks!
    – drautb
    Commented Feb 13, 2014 at 20:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.