Sublime Forum

*SOLVED* tmLanguage patterns include

#1

Solution: The problem was the include k,v pairs need to be small json objects, i.e. { “include”: “#numericLiterals”}

I am using a method I saw in one of the many github or bitbucket tmLanguage files for the plugin I am working on.

What is happening is I am breaking out each “pattern type” into its own data structure so it is a little easier to follow. However, only the last include is effective.

In this configuration, only the “comments” re patterns are working.

See the partial example below. The full document is at https://github.com/slestak/unibasic.tmlanguage

{ "name": "Unibasic", "scopeName": "source.unibasic", "fileTypes": "foo"], "patterns": { "include": "#numericLiterals", "include": "#basicStatements", "include": "#comments" } ], "repository": { "numericLiterals": { "patterns": { "name": "keyword.unibasic", "match": "\\d+", "captures": { "0": { "name": "constant.numeric.integer.unibasic" } } },

0 Likes

#2

I do not see the solution yet, but I do see the problem. The plist that is generated does not mention the other includes at all. I will look at the code in that script to see what is expected.

0 Likes

#3

The powershell plugin uses this construct. It is not the original example I saw.

github.com/SublimeText/PowerShe … tmLanguage

0 Likes

#4

Ok, this looks like the authoritative reference.

manual.macromates.com/en/language_grammars

0 Likes