Home Download Buy Blog Forum Support

*SOLVED* tmLanguage patterns include

*SOLVED* tmLanguage patterns include

Postby slestak989 on Wed Oct 12, 2011 7:02 pm

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

Code: Select all
{ "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" }
            }
          },
Last edited by slestak989 on Mon Oct 17, 2011 4:47 pm, edited 1 time in total.
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am

Re: tmLanguage patterns include

Postby slestak989 on Wed Oct 12, 2011 9:45 pm

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.
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am

Re: tmLanguage patterns include

Postby slestak989 on Wed Oct 12, 2011 9:55 pm

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

https://github.com/SublimeText/PowerShe ... tmLanguage
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am

Re: tmLanguage patterns include

Postby slestak989 on Wed Oct 12, 2011 10:02 pm

Ok, this looks like the authoritative reference.

http://manual.macromates.com/en/language_grammars
Using ST2 on: Win7 Pro 64 || Win7 32|| Fedora 16
slestak989
 
Posts: 31
Joined: Tue Oct 04, 2011 3:40 am


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 9 guests