[TxMt] Informative text for snippets

Charilaos Skiadas cskiadas at gmail.com
Tue Aug 7 23:48:35 UTC 2007


On Aug 7, 2007, at 7:31 PM, Édouard Gilbert wrote:
> Le 7 août 07 à 20:14, Charilaos Skiadas a écrit :
>> On Aug 7, 2007, at 12:10 PM, Édouard Gilbert wrote:
>
> Woups, sorry. Here it is. Please ignore the '!'.
>
> (defmethod! ${1:name} (${2:parameters})
> 	:initval	'($3)
> 	:indoc	'($4)
> 	:doc "${5:Documentation for $1.}"
> 	$0
> )

[snip]

> Thus having the parenthesis inside the $2 seems a bad idea, as it  
> shouldn't be possible to remove them while typing.
>
> If instead, you meant switching to
>
> (defmethod! ${1:name} (${2:(${3:parameters})})
> 	(...)
> 	$0
> )
>
> In that case, the situation is pretty much the same as before. It's  
> just that, instead of hitting delete before actually typing code,  
> one would have to hit tab. Ideally, the solution would be for the  
> text to disappear when one hit '(', but only in this context (I  
> can't get rid of the otherwise so useful auto-bracketing function,  
> especially when coding in Lisp).
>
> I was thinking about overriding the '(' key between the parenthesis  
> in the right scope, i.e. between the parentheses around the  
> parameters, but not in the parameters themselves, an replace it by  
> a simple '($0)' snippet. Does it seems a feasible solution?

I think that trying to override '(' in the right scope will not be  
easy to do. I think your problem really arises from the fact that you  
want the word "parameters" to be there. Why not simply use $2 instead  
of ${2:parameters}, like you have $3 with no default value? It seems  
that would solve your problems, at the small cost of having to  
remember what you are supposed to place at the second tab stop. I  
think that any other solution would be too cumbersome compared to  
this simple change.

> Édouard

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list