[TxMt] Informative text for snippets

Charilaos Skiadas cskiadas at gmail.com
Tue Aug 7 18:14:24 UTC 2007


On Aug 7, 2007, at 12:10 PM, Édouard Gilbert wrote:

> Hi everyone,
>
> I'm wondering if there was a mean to insert some kind of  
> “informative text” in a snippet, i.e. text that informs you of what  
> should be inserted where but disappears when it's not needed any  
> longer.
>
> Here's a short example (a method definition in some Lisp dialect)  
> of a problem I currently face that should make the situation a bit  
> clearer.
>
> Here is what I'd want to appear with my defmethod snippet, with  
> “normal” default text between [ ] and informative text between { } :
>
> (defmethod [name] ({parameters}) ({code}))
>
> The parameters are written as “(name type)”, so when I reach the  
> {parameters}, the first thing I do is adding a parenthesis. Result:  
> the default text (“parameters”) is still there, but now unselected  
> and between parenthesis. I thus have to remove it by hand, which is  
> quite annoying. Of course, a possibility is to let the default  
> string empty, but you can easily get lost in your structure, then  
> (especially in Lisp). So is there a way to have text reminding you  
> what you should be typing, but disappearing after a while (ideally,  
> when you hit tab in order to jump to the next snippet point or when  
> you reach $0)?
>

Not sure if this helps, and you haven't provided the snippet text so  
that we could make changes there, but one way to go about it is to  
not expect someone to type the parentheses, instead having them as  
part of the snippet, as an extra tab trigger, like so:

${1:(${2:parameters})}

> Thank you very much,
> Édouard

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list