Question

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?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top