Programmable snippets
Just wondering if there is any way to make programmable snippets like in yasnippets for emacs.
Kinda like:
var BrowserWindow = require('browser-window');
In this example, when typing BrowserWindow the text inside the require statement is converted from camel case browser-window
This would be awesome.
Anyway I could help?
The desired behavior is known as transformations in TextMate snippet terminology. We should probably use that as the starting point for this feature request.
Alright, sounds good. I'll starting looking at the spec.
:+1:
+1
+1
+1
+1
Any news on this, or any guidance where to start looking at?
+1
Rather than use regular expression-based TextMate-style transformations, it might be more flexible to allow calling some kind of user-defined function.
This would allow for regular expressions, but also other things.
I've used this kind of feature in the past in another editor to insert the current date/time, or the current file name, as part of my snippet.
I wrote up #257 because I’d missed this one way back in the issues list, but I’m linking it here because it’s got some example use cases and some technical discussion.
+1
I’m closing this one because the example described can be done now — #260 added support for snippet transformations.