[TxMt] Tab-stops work strangely with nested snippets?

Charilaos Skiadas cskiadas at gmail.com
Sat Aug 11 20:12:06 UTC 2007


On Aug 10, 2007, at 2:00 PM, Cocoa Bob wrote:

>
> I want to produce
> [origin [pt x]];
> using a snippet called msg (short for message) that looks like this
> [${1:Receiver} ${2:message}]
>
[snip]

>
> If I am wrong in my thinking tell me why. If I am right maybe it is  
> some
> programming difficulty with nested snippets that prevents the desired
> behavior.

The reason things behave in a way that you did not expect is simply  
that nested snippets are not a supported feature of TM yet, though  
one often requested. (You can search through the ticket system, and  
file a new ticket if it is not already there: http://macromates.com/ 
ticket/ ).
Hence atm, pressing tab within a snippet just moves forward among the  
tab stops. There are two ways to solve the problem in your case:

1. Use a key equivalent instead of a tab trigger. Say for instance  
that you have set the key equivalent for your command to F8. Then  
using that instead of "msg+tab" would give you a more desired  
behavior (essentially, the old snippet is forgotten the moment the  
new one is triggered).
2. Set the snippet to be: [${1:Receiver} ${0:message}]. Then "msg 
+tab" will work as expected on the message side, since you have ended  
the snippet at the 0th tab stop. On the other hand, you will still  
have problems if you tried to call "msg+tab" on the Receiver side  
(This would be a problem in the first case as well, though of a  
slightly different nature).

> Thanks Bob

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list