Ok, these might be a little bit of a weird question and unfortunately many of the details are vague because they come from experiments I preformed several months ago, so I probably should apologize for that in advance, but as I find myself confused about this technicality regarding snippets, I felt like asking just in case anyone has similar experience.
In particular after playing around a little bit I remember noticing that sublime did not like when a placeholder field had its default value defined twice or more, so for example
${1:data} = $1 + $2
was okay whereas
${1:data} = ${1:data} + $2
would not be inserted. Of course this usually is not a problem, but can be in some rare cases,eg if snippets were generated by a script and care had not been taken.FWIW I also remember noticing these only for mirrored fields you can tab through, so placeholders for external parameters caused no problem even if they were different,eg
${PARAMETER:data} = ${PARAMETER: something else} + $1
With that in mind, I considered writing some code to handle this issue by preprocessing such snippets before passing them down to insert_snippet command, but due to lack of time and other priorities I did not pursue it. Now that I finally got around to it, to my surprise I can no longer reproduce this issue. Snippets like the one above ${1:data} = ${1:data} + $2 are inserted without any problem, which is great but leaves me wondering whether:
-
During my experimentation, I made some mistake and stuck with the wrong conclusion, in which case the extra code is redundant
-
My conclusions were correct and this “technicality” existed in previous versions but not in the latest one, so the extra code might be needed after all
Part of the reason why I considered the second scenario possible is that I cannot really remember if my sublime was upgraded to 3211 shortly before or after those experiments and it did not occur to me to check the sublime version at the time. Now as I couldn’t find anything relevant in the change log, it is very likely that I am dealing with the first case, but not really being sure I felt like it might be worth asking here, just in case someone has come across this In older versions of sublime or could confirm/disprove either claim.