Sublime Forum

Snippet arguments

#1

Hi,

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

my snippet :

<snippet> <content><![CDATA[ Hello $PARAM1 in $TM_FILENAME ]]></content> </snippet>
So how can I give an angument to a snippet ?

in my plugin:

self.view.run_command("insert_snippet", {"name": "Packages/Bootstrap/test.sublime-snippet"})

Thanks.

0 Likes

#2

Did you find the solution to this…its driving me mad!

0 Likes

#3

view.run_command(‘insert_snippet’, dict(contents="${PARAM1}s", PARAM1=“it works!!”))

0 Likes

#4

Thanks Castles (Do you mind if I call you ‘Castles’? :wink:

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!!” })

0 Likes