Home Download Buy Blog Forum Support

Syntax highlighting, overriding imported style

Syntax highlighting, overriding imported style

Postby ripvtech on Sun Oct 21, 2012 1:08 am

Hello,
I'm working on my first "plugin" for Sublime Text 2 and I'm going though ok, expect I can't seem to override the HTML syntax highlighting.

For some insight, I'm creating a new syntax along the lines of django template

Here is what I have(shortened for simplicity):
Code: Select all
{ "name": "My Syntax",
  "scopeName": "source.mysyntax",
  "fileTypes": ["html"],
  "patterns": [
     { "include": "text.html.basic"},
     {
        "name": "print.variable.mysyntax",
        "begin": "(\\{\\{)",
        "beginCaptures": {
           "1": { "name": "keyword.mysyntax"}
        },
        "endCaptures": {
           "1": { "name": "keyword.mysyntax"}
        },
        "patterns": [
           { "include": "$self" },
           {
              "name": "string.mysyntax",
              "match": "."
          }
        ],
        "end": "(\\}\\})"
     }
  ],
  "uuid": "xxx"
}



Essentially I want it to highlight all double "{{" and "}}" however it doesn't work when those are in a tag definition.
For example:

This works:
Code: Select all
{{ my.var }}

This doesn't work:
Code: Select all
<div class="{{ my.var }}"> </div>


The example that doesn't work is picking up the syntax highlighting from html and not from my definition... How can I "mesh" the two together?

Thank you in advance!
~Derek
ripvtech
 
Posts: 1
Joined: Sun Oct 21, 2012 12:58 am

Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests