[TxMt] naming embedded (included) scopes ?

Allan Odgaard throw-away-1 at macromates.com
Sun Apr 9 14:34:33 UTC 2006

On 9/4/2006, at 15:22, Dirk van Oosterbosch, IR labs wrote:

> [...] Is it possible to give an embedded (or included) language an  
> extra scope layer name, so I can use that in a theme?

Not really. When you include another grammar, that rule (which  
performs the include) does not match anything itself, and so, there  
is nothing to assign a name to.

Normally an embedded language rule would look something like this:

    {  name = 'source.embedded.php.html';
       begin = '<\?php'; end = '\?>';
       patterns = ( … );

Here the scope is clearly marked by having to start with <?php and  
end with ?>. In your case, there does not seem to be such clear  
markers, but instead, everything not matched by the cheetah grammar  
is “embedded.”

There are however ways in which you can likely achieve the desired  
effect. But I am not sure exactly how much you want to show as  
“embedded.” I.e. if you were able to add this extra scope name layer,  
then a line like: “that’s nice” would have the entity shown as  
embedded code, as it is matched by a rule included from the HTML  

More information about the textmate mailing list