[SOLVED] Snippets with multiple options


#1

I want to know if there’s a way to show a sub-snippet suggestion.
Eg.

‘Element declaration’:
prefix: 'ele’
body: ‘element.’ <- At this point, the editor must show suggestions. IF user types ‘ele’, loads ‘element.’ and give suggestions of snippets based on a ‘case’ or ‘if’ inside this ‘ele’. Something like this

‘Element declaration’:
prefix: 'ele’
body: ‘element.’
—if(prefix: ‘n’)
-----body: ‘name’
—else if(prefix: ‘w’)
-----body: ‘width’

Final result would be like element.name or element.width

Any help?
Thank you.


#2

No, there isn’t a capability like what you’re specifying built in to the snippet system. But if you create a snippet that expands ele to element. then perhaps the autocomplete system can pick that up and give the suggestions you’re looking for.


#3

Then, in this case, the answer that I need would be accomplished creating a auto-complete package with specs and all?


#4

Unless there is already an autocomplete package for the language you’re working with.


#5

I looked for it, but I don’t think it exists.
It’s for autocompleting Protractor API https://angular.github.io/protractor/#/api


#7

@leedohm
There’s an ‘autocomplete hello word’ package available?.. A simple example?


#8

Check the autocomplete-plus README for the provider API documentation:


#9

Thank you so much!