Sublime Forum

How do you debug a language definition file

#1

Hello,

I’m trying to use a REBOL language definition file (attached) from a TextMate REBOL bundle and Sublime just seems to hang when I select REBOL to try to set the language for a file. I’ve created a Rebol package dir under AppData\Roaming\Sublime Text\Packages and added the file Rebol.tmLanguage there. Is this enough for Sublime to get going or does a full package need to be created even though the only content (at present) is the language definition? I see that Sublime includes a Python script that looks like it might do this, but there is no documentation for it. I don’t see any logs that can help with debugging this, either. For the record, the language definition is known to work, so it’s not a question of being malformed or incorrect. Sublime also created a Rebol.tmLanguage.cache file - I’m guessing this means that it was able to parse the file.

Cheers,
Adrian
Rebol.zip (3.53 KB)

0 Likes

#2

This should be enough. I did it myself for two languages.

To my knowledge there is just one debuging aid. Typing ctrl+alt+p shows in the statusbar the patterns from tmLanguage which are in effect at the caret position.

Additionally, I created a file with correct and wrong statements in the language of choice. I can see if the syntax highlighting is as expected.

0 Likes

#3

The problem is that I don’t get to the point where the I can try ctrl-alt-P - the editor hangs as soon as I select Rebol as the file type from the status bar or through the menu.

0 Likes

#4

I remember this situation. I resolved it with commenting and uncommenting parts until the evil pattern was identified. It was time consumimg. And yes, Sublime is not Textmate and not fully compatible.

Even if the XML is well formed, Sublime rarely hung on some misspelled regular expressions. But in most circumstances you get an error message.

First of all, in pattern singlequotedString I would replace ’ with &quot.

0 Likes

#5

After doing as suggested and manually re-introducing removed elements into the language definition, it seems the offending bit is this:

        <dict>
            <key>name</key>
            <string>serie.rebol</string>
            <key>match</key>
            <string></string>
        </dict>

I guess the empty regex causes problems. Sublime could probably be a bit more robust to this kind of problem and just ignore the whole entry if the regex is empty instead of hanging.

0 Likes