Sublime Forum

Help with .tmLanguage

#1

Hi everyone, this is my first post on the forums. I am trying to create a tmLanguage file for a template language. This language is context sensitive for when something is evaluated.

Here is the pastebin for it so far: pastebin.com/W6w2ngJS
Here is the pastebin for a very small wtl file: pastebin.com/hpqNjcMS

What’s the problem? Line 23 of the tmLanguage: (if)(()(\s\S]*?)())(?:\s+|)({)
I basically want to capture what’s inside the round brackets. And if there’s a %variable or a keyword operator, I want to name them.
So that if (%variable === 5) { blah blah }
so that %variable would be punctuation.attribute-name.variable.wtl
and the === would be keyword.operator.wtl

I looked around JavaScript.tmLanguage, CSS.tmLanguage and HTML.tmLanguage to get an idea of how I can accomplish this, and I think the closest I got to was:

    <key>patterns</key>
    <array>
        <dict>
            <key>include</key>
            <string>#tag-stuff</string>
        </dict>
    </array>

Any help would be appreciated!

Thank you

0 Likes

#2

The answer to my question is here:
reddit.com/r/SublimeText/com … mlanguage/

0 Likes