I think this is a no-brainer.
Snippets are are one of the reasons why I made a switch to Sublime Text and I feel others feel the same. Sublime Text would be even cooler, and more people would be using it if you were able to do logic in snippets. it doesn’t have to be anything complex.
I think being able to store $1, $2… values in variables and then being able to run “if-then” logic off of those stored values would help 90% of users.
In my particular scenario, I created a documentation snippet where I am describing input and output variables of JavaScript code as such (pseudo code):
created by {$1:my name goes here} on {$2:date} (oh that's another thing, can we the ability for snippets to auto insert current date at the time of creation?) Inputs: {$3:var1} - {$4:var1 type} {$5:var2} - {$6:var2 type} {$7:var3} - {$8:var3 type} {$9:var4} - {$10:var4 type} ... ... ... Details: $3 - {$11: var1 details} $4 - {$12: var 2 details} ... ...So this works great but if the code i’m documenting only has 1 input variable, I spend a lot of time deleting tabbed sections.
It would be nice if I could do: "if $5 == null/empty, ignore/skip asking for var 3 and var 4 data