[TxMt] Language grammar question - how does newline get inserted when you type "{\r}" ?

Allan Odgaard throw-away-1 at macromates.com
Sat Feb 18 03:26:19 UTC 2006


On 17/2/2006, at 21:58, John Clayton wrote:

> I'm working on a grammar for Io [...]

There actually already is an Io bundle at the repository [1] (you  
need svn to check it out).

> [...] I'd like to have the same behavior for parens as one gets for  
> braces, but I can't seem to locate where this is enacted.

The current Io bundle does this. For the records though, the way it  
is achieved is by having the language grammar match empty parenthesis  
and have it assign a scope name to that construct (for example  
meta.empty-parenthesis.io).

What this then allows us is to overload keys when the caret is inside  
empty parenthesis, by for example using scope selector source.io  
meta.empty-parenthesis.io.

If you look at the existing Io bundle, you will see that there is a  
snippet with this scope, key equivalent set to return, and the body  
of the snippet is: “\n\t$0\n”, which is the sequence of text we want  
to have inserted, when pressing return inside empty parenthesis.


[1] http://anon:anon@macromates.com/svn/Bundles/trunk/Bundles/ 
Io.tmbundle/




More information about the textmate mailing list