[TxMt] Re: Placeholders within transformations in snippets

Allan Odgaard mailinglist at textmate.org
Tue Dec 2 12:58:31 UTC 2014

On 2 Dec 2014, at 1:47, Nigel Chapman wrote:

> I’m trying to write a snippet to insert operator declarations in 
> Swift.
> […] I assume this is because in that context $3 and $4 refer to 
> captures from the regular expression. Is that so? Is there any way 
> round this?

Correct. A snippet can’t insert new placeholders via the format 

An approximation would be something like this:

	${1|infix,prefix,postfix|} operator ${2:name} 

Or somewhat pretty-printed:

	${1|infix,prefix,postfix|} operator ${2:name} {
		${1/(infix)|.*/${1:+\n\tassociativity }/}
		${1/(infix)|.*/${1:+\n\tprecedence }/}

More information about the textmate mailing list