On Aug 18, 2012, at 4:16 AM, Allan Odgaard <odga...@macromates.com> wrote: On Aug 18, 2012, at 6:53 AM, Gerd Knops <ge...@bitart.com> wrote:- Right now it seems injection appends to the patterns. Would it be possible to also have 'early injection' where the new patterns are prepended to the patterns? I am experimenting with special comment sections like /*H: */, and can't seem to do this with injection. (Another example application: Headerdoc/Docbook comments /** */ etc). Right. Here is a simple example: I like to use line comments '//' that begin at the start of the line as code separators, so I draw the line background in a different color, so basically match = "^//.*\n?"; This doesn't work with injections, because the 'regular' grammar already gobbles up any '//', so the injected grammar never sees it. Similar for docbook comments: an injected grammar never sees the '/**' comments. Another example is leading whitespace: I like to have leading tabs highlighted with alternating light backgrounds, like so: ![]() I would LOVE to use injection for that, unfortunately many definitions eat up leading space. So my only recourse is to write custom language grammars for ALL languages I want to have this feature (eg ALL languages I use), start with my rules (so they get first dib), then include the actual language. Though we definitely do need more flexibility wrt. injection, I think I did the append because then an injected grammar will not screw up the parent grammar, with our current grammars though, I think none of them would. I.e. this is only when you inject fallback matches. Done. - Would it be possible to access other grammars repositories? I could imagine something like Oh, that made my day!!! Thanks! Gerd |
_______________________________________________ textmate-dev mailing list textmate-dev@lists.macromates.com http://lists.macromates.com/listinfo/textmate-dev