Looking at the post http://blog.macromates.com/2011/format-strings/, I was excited by the idea of being able to dynamically include other patterns into the matched scope.
However, it doesn't quite work. I have in my Jekyll grammar, a pattern:
{ begin = '{% highlight (html) %}'; end = '{% endhighlight %}\n'; name = 'source.$1.embedded.html.markdown'; patterns = ( { include = 'text.html.basic'; }, ); },
This is handled fine: it matches as intended, and puts the html into the name as expected.
However, I can't use the same trick in the included patterns:
{ begin = '{% highlight (html) %}'; end = '{% endhighlight %}\n'; name = 'source.$1.embedded.html.markdown'; patterns = ( { include = 'text.$1.basic'; }, ); },
In this case, the syntax highlighting of the embedded code is not applied.
I know this is a simple example: I am hoping to be able to extend it to automatically match whatever type of file I want highlighted (python, js, ruby, html, css, ... you get the picture).
Regards,
Matt.
On 10/01/2012, at 20.34, Matthew Schinckel wrote:
[…] I can't use the same trick in the included patterns:
{ include = 'text.$1.basic'; },
[…] I am hoping to be able to extend it to automatically match whatever type of file I want highlighted (python, js, ruby, html, css, ... you get the picture).
The idea is to do this via injections instead — so you put the “token” in the scope and then inject HTML, JS, Python, etc. into meta.embedded.{html,js,python} etc.
The overall system for this is in place but we want to extend the scope selector syntax slightly to better control the injections, so none of the current bundles have been converted yet.