Package request: more powerful snippets


The snippet system in Atom is very basic.
If I expand an “if” snippet, and go to the first tabstop, I cannot press tab to expand, say, an “and” snippet (these are hypothetical snippets, but I’m sure you can figure out what they are). Instead, pressing tab inside the tabstop will bring me to the next tabstop.

Another limitation is the lack of repetitions. Repeated if-else clause snippets are not supported.

Also, atom forgets your snippet if you move your cursor outside a tabstop. I would prefer it to remember.

I’m sure some of you have heard of xptemplate from the vim world. Something like that would be awesome to have for atom.

I’ve thought about making a package myself, but it seems really daunting, and I don’t think I could pull it off. I’m putting this idea out there for any ninjas who want it.

Here is any idea I had while trying to figure out how to do this:
I’m going to use c# as an example, but any language that supports inline comments could use this format.

Here is how a for snippet would be implemented:

for (int \*#tab 0 {*\i\*}*\ = 0; \*#mirror 0*\ < \*#tab 1 {*\len\*}*\; \*#mirror 0*\) 

Notice that this is actually valid c# code. To make it easy for the parser, all snippet directives are preceded by a pound sign.

That was just an idea. Perhaps not the best, but it would make it so that the snippet process is more transparent to the user.

That’s all, thoughts?

Snippet inside a snippet