Sublime-SQF-Language icon indicating copy to clipboard operation
Sublime-SQF-Language copied to clipboard

SQF.tmLanguage: block rule has a stray block key, console error on load and braces get no block scope

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports:

Sublime Text 4215 on Windows, SQF Language 2025.09.29. Installing the package prints this in the console while the syntax is loaded:

unexpected rule type, was expecting one of match, include, begin or patterns, got: {block: {begin: \{, beginCaptures: {0: {name: punctuation.section.block.begin.sqf}}, end: \}, endCaptures: {0: {name: punctuation.section.block.end.sqf}}}}

Cause: in SQF.tmLanguage (line 113) the brace rule is a pattern dict that contains only a key block, with begin/end nested one level too deep:

<dict>
    <key>block</key>
    <dict>
        <key>begin</key> <string>\{</string>
        ...
        <key>end</key> <string>\}</string>

The entry in patterns has to hold begin and end directly (or include a repository item named block). As written, Sublime drops the rule. Effect I checked: in if (_x > 3) then { hint "big"; } else { ... }; every { and } has only the scope source.sqf, not punctuation.section.block.begin.sqf / ...end.sqf. Keywords, strings and comments are scoped correctly.

Fix: remove the <key>block</key> wrapper so begin, beginCaptures, end and endCaptures sit directly in the pattern dict.

dpc00 avatar Oct 09 '26 06:10 dpc00