I recently added support for .rcss files to my Ruby on Rails project, those being the equivalent of .rhtml, but for stylesheets. I've been trying to make a grammar that gives me all the nice ERB autocompletion and syntax coloring that exists for .rhtml files, but seem to be running into issues with the scope selectors.
My grammar, based on th HTML (Rails) one is here: http://pastie.textmate.org/63540
Using that, I get proper syntax coloring for embedded Ruby if I use it at the root level, but I still don't get autocomplete. And inside a CSS selector, I can't get anything.
The output I'm getting: http://pastie.textmate.org/63543
Is there a way to specify conditional scope within a grammar? It seems like once it hits the CSS selector, it doesn't recognize ERB anymore.
On 22. May 2007, at 17:12, Shane Liesegang wrote:
[...] Using that, I get proper syntax coloring for embedded Ruby if I use it at the root level, but I still don't get autocomplete. And inside a CSS selector, I can't get anything. [...] Is there a way to specify conditional scope within a grammar? It seems like once it hits the CSS selector, it doesn't recognize ERB anymore.
The grammar is basically a tree of rules, when you enter a subtree, only the rules for that node are “active”.
This means grammars which matches larger structures of the document are not possible to augment without actually changing the grammar, so that’s your only option for now, i.e. clone the full CSS grammar and just modifiy it, rather than include it. There will be a system for injecting rules into existing grammars without forking them in the future.