Home Download Buy Blog Forum Support

insertSnippet

insertSnippet

Postby Marciano on Tue Sep 29, 2009 2:45 pm

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
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: insertSnippet

Postby jps on Tue Sep 29, 2009 2:59 pm

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:

Code: Select all
snippet = "hello ${1:bob}, how are you today?$0"
view.runCommand('insertInlineSnippet', [snippet])
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: insertSnippet

Postby Marciano on Tue Sep 29, 2009 3:37 pm

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

It has been said before, but... YOU ROCK :ugeek:
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 9 guests