-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smarter snippet holes #445
Comments
One really smart thing we probably could do with snippets is to support repeating it. For example if you issued the "next" command on "$0" it would insert the snippet once again and put the cursor in the new "$1". This would be really useful for inserting a large number of items in a map/dictionary. Cases in a switch state and so on. |
I think you definitely want this kind of functionality when you're in a list-valued snippet hole, to indicate you'd like to create another element of the list, which would then insert a new instance of the snippet defined for elements of that list I wonder how useful it is in other situations. Because for example how does it know where to put the new snippet instance? At the cursor? After the current scope instance? |
We probably need add a lot more boilerplate to our snippet definitions ;) We definitely want to be able to enabled this only on particular snippets and in those cases we need to instruct it how it should add the next one. |
I don't think we're actually too far off. On the insert snippet PR we can already specify the default insertion scope for a snippet, so that eg "snip foo after this" will insert after current if statement. |
I know. But I'm not sure inserting the snippet in relation to a token or selection is the same thing as inserting the next snippet in relation to the previous snippet. I'm just saying we probably need to add some more information anyway. |
I'd be inclined to restrict that kinda thing to nested snippets in list-valued snippet holes at the start and see if that gets us what we need |
The goal
We'd like to enhance the ability for snippets to be used to perform high-level syntactic transformations. To this end we'd like to add the following abilities:
n
instances of the hole snippetSome examples
if
-else
statement to aswitch
statement:"switch repack if state"
"bring air past bat as list"
Examples we'd like to support
Questions
References
The text was updated successfully, but these errors were encountered: