+3
Advanced snippets
Please provide nested substitution, python code evalution or builtin commande evalutaion inside snippet content.
The problem is that I need to make 2 or 3 substitutions of TM_FILEPATH to properly get the namespace declaration.
A great functionnality would be the possibility to evaluate some python code or a set of builtin command with a kind of `substitute('foo','f','b')` syntax like in vim snippet.
+2
Eric Clemmons fa 12 anys
I am attempting the same thing here & have the exact same issue: https://gist.github.com/3102439
0
Erwan Richard fa 12 anys
I was trying to make exactly the same snippet as you do !
Finally I have made a plugin that easily insert namespace and use statements (based on ctags definition). Take a look here : https://github.com/erichard/SublimeCTagsPHP
Also, I still think that a set of builtin command would be great :-)
+1
Evan Kaufman fa 12 anys
Allowing evaluation of python code in a snippet could open all kinds of cans of worms...but nested substitutions of a snippet would be a pretty capable feature, something like:
${${var_name/regex/format_string/}/regex/format_string}
If there's a worry about resource usage or recursion, it would be reasonable to set an upper limit on the amount of nesting levels to allow (2 or 3, for example)
0
Liam Cain fa 12 anys
You might want to try my SMART_Snippets plugin. It aims to solve this exact problem. I haven't updated it in a while do to lack of interest but I'm still looking for testers (preferably people who know python and are willing to submit pull requests).
https://github.com/BoundInCode/SMART-Snippets
Customer support service by UserEcho