[TxMt] Augmenting grammars in the future (was: Design of Textmate)

Rob Rix rix.rob at gmail.com
Thu Apr 27 15:59:59 UTC 2006


I am _really_ looking forward to this, Allan.

On 27-Apr-06, at 1:34 AM, Allan Odgaard wrote:

> On 26/4/2006, at 18:25, Plessl Christian wrote:
>
>> [...] Is there a way to implement this in Textmate without either:  
>> a) modifying all programming language modes with the new rule, or  
>> b) creating new language bundles C (+fixme), Java (+fixme) etc.  
>> that include the language definitions for C/Java and add the new  
>> syntax highlighting rule?
>
> There is not, no. But a solution will appear, and is conceptually  
> rather simple IMO.
>
> Currently the scope selector is disabled for language grammars, now  
> imagine it wasn’t, and that selector decided where to inject the  
> grammar!
>
> That would allow to tear out the PHP, Ruby, and Smarty handling of  
> the HTML grammar, and instead have that with the language. Likewise  
> it allows the mentioned FIXME/TODO grammar to be in the TODO  
> bundle, and be injected based on a scope selector -- disabling the  
> TODO bundle would then disable this injection automatically.
>
> There is a scope addition which will make this more powerful,  
> namely exposing arbitrary file attributes in the scope (which scope  
> selectors can then target), that way, the Java bundle can inject <%  
> java %> support to HTML files only when the file type attribute is  
> ‘jsp’, and the Subversion bundle can inject the various svn  
> keywords only when the SCM attribute is ‘svn’.




More information about the textmate mailing list