More Features For Snippets


When creating snippets, it would be nice to have 2 additions:

  1. An option element. This would make it so when you reach this place in the snippet, you are presented a list of different options. This would be useful for situations where you have 2 different (maybe long) options, and the user shouldn’t have to type it out. The cson code could be like this: '$[1:int,boolean,float] ${2:name} = ${3:value}', where the 3 values for 1 would be int, float, or boolean

  2. Reactive snippets. Basically this would mean depending on the values you chose on a certain place in the snippet, it would change the following text. This would be useful for when you have the same “command”, but if the user choses one option over the other, it switches syntax somewhat. The cson code would be complex, but it could be somewhat like this:

     'body': '$[1:give,take] $2'
     'with': [
          'id': 2
          'text': 'give syntax'
          'if': ['1', 'give']

which would add give syntax to the text in place of $2 if element 1 was give.
Another nice feature would be to have prefixes be regular expressions. This would break any current snippets because they can only use letters right now, but regular expressions probably could replace the reactive snippets idea.


@MrYurihi: I think you have a nice idea there. Not sure how you would approach something like this in the Atom framework… very possibly you need to develop a Package.

From the small experience I have, I would tackle this task with Hotkey’s hotspring (?) functionality.

Your thoughts?

  • Dan Padric


This would be through the Snippets package