Home Download Buy Blog Forum Support

Snippet with prefilled completion list

Snippet with prefilled completion list

Postby thebreiflabb on Wed Jan 02, 2013 2:42 pm

Hello,

I am trying to create a snippet where one of the tab completion stops has pre-filled a static list of available options.

E.g.

Code: Select all
<snippet>
    <content><![CDATA[<argument name="$1" type="${2:type1|type2|type3}">]]></content>
    <tabTrigger>arg</tabTrigger>
</snippet>

I would want it to output the argument tag, with the selection at $1 (which it does) and when pressing tab, go over to the next - $2 and instead of it saying type1|type2 etc. If it could be prefilled with the first value (type1) and automaticly open a dropdown with all the possible values (like autocompletion does). So when coming to the type attribute, I can use the arrow keys to choose which type the argument should be.

Is this possible?
thebreiflabb
 
Posts: 3
Joined: Wed Jan 02, 2013 11:39 am

Re: Snippet with prefilled completion list

Postby pier on Wed Jan 02, 2013 6:47 pm

It is possible using some python instead of a regular snippet. I wouldn't know how to do it though...

You should be able to use regex to achieve something closer to that than using plain snippets too. Check the techniques from Andy Gibson in this post. It's not exactly what you want... but maybe will give you some ideas to solve your problem faster.
viewtopic.php?f=2&t=7858
pier
 
Posts: 92
Joined: Fri Jun 15, 2012 2:47 am

Re: Snippet with prefilled completion list

Postby thebreiflabb on Thu Jan 03, 2013 12:18 pm

Thanks for leading me in the right direction, however I am not that good with these configurations of ST - I have only tried a few simple snippets, and I couldn't implement the techniques from Andy to what I wanted. I'll live without for now, and maybe try again if I stumble upon anyone having done similar to this.

But thanks again :)
thebreiflabb
 
Posts: 3
Joined: Wed Jan 02, 2013 11:39 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 34 guests