Sublime Forum

insertSnippet

#1

Hi all (and jps in particular),

is there any documentation on the “insertSnippet” command? It is listed as “undocumented”: does this mean that there is no documentation available right now, or that none will be forthcoming (i.e. we should not use this command)? I would like to be able to insert some text via a plugin, but then rely on the tabbing mechanism to move around, the way you can wiht snippets. Thanks!

M

0 Likes

#2

For snippets with plugins, your best bet is to use the insertInlineSnippet command: this takes the contents of the snippet as a parameter, for example:

snippet = "hello ${1:bob}, how are you today?$0"
view.runCommand('insertInlineSnippet', [snippet])
0 Likes

#3

Wow! This is awesome! It’s exactly what I need.

It has been said before, but… YOU ROCK :ugeek:

0 Likes