Home Download Buy Blog Forum Support

snippet arguments

snippet arguments

Postby Tchiize on Sun Jul 22, 2012 3:49 pm

Hi,

I would like to give some arguments to a snippet. But I don't know how to do this ?

my snippet :
Code: Select all
<snippet>
   <content><![CDATA[
Hello $PARAM1 in $TM_FILENAME
]]></content>
</snippet>

So how can I give an angument to a snippet ?

in my plugin:
Code: Select all
self.view.run_command("insert_snippet", {"name": "Packages/Bootstrap/test.sublime-snippet"})


Thanks.
Tchiize
 
Posts: 1
Joined: Sun Jul 22, 2012 12:12 pm

Re: snippet arguments

Postby DomSkech on Sun Mar 03, 2013 11:45 pm

Did you find the solution to this...its driving me mad!
DomSkech
 
Posts: 2
Joined: Sun Mar 03, 2013 11:44 pm

Re: snippet arguments

Postby sublimator on Fri Mar 08, 2013 4:42 am

view.run_command('insert_snippet', dict(contents="${PARAM1}s", PARAM1="it works!!"))
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: snippet arguments

Postby DomSkech on Fri Mar 08, 2013 3:13 pm

Thanks Castles (Do you mind if I call you 'Castles'? ;-)

Its not the same as 'including' a snippet though, which is far more useful.

self.view.run_command("insert_snippet", {"name": "Packages/Test/snippet_with_param.sublime-snippet", PARAM1="it doesnt work!!" })
DomSkech
 
Posts: 2
Joined: Sun Mar 03, 2013 11:44 pm


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests