I found this page because I was searching for this same answer. I’m creating a package that I want my users to be able create their own (possibly massive) Snippet files with their own dynamic ${PARAMn}
placeholders to be filled by a single command. I finally figured out how to do it, and from what I can see, is the first reply that actually answers the question.
This Snippet in Packages/User/test_with_args.sublime-snippet
:
<snippet>
<content><![CDATA[
Hello, param1 = [${PARAM1}] param2 = [${PARAM2}] and param3 = [${PARAM3}].
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source comment</scope>
</snippet>
with this in your command:
args = {
'name': 'Packages/User/test_with_args.sublime-snippet',
'PARAM1': "alpha",
'PARAM2': "bravo",
'PARAM3': "charlie"
}
self.view.run_command("insert_snippet", args)
Produces this output:
Hello, param1 = [alpha] param2 = [bravo] and param3 = [charlie].