Home Download Buy Blog Forum Support

Insert snippet from menu

Insert snippet from menu

Postby Marciano on Tue Oct 06, 2009 3:03 am

Hi,

I'm trying to add a menu (under Tools|Packages) for my LaTeX package. Almost everything works (looking at the default menu file helped me understand the format reasonably well), with one exception. I cannot seem to create a menu item that adds a snippet. I am trying:
Code: Select all
<item caption="Emphasize" command="insertSnippet emphasize"/>


where emphasize is a snippet in the LaTeX plugin. Issuing

Code: Select all
view.runCommand("insertSnippet emphasize")


in the console works as expected. What am I doing wrong?

Thanks!
M
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: Insert snippet from menu

Postby jps on Tue Oct 06, 2009 4:48 am

I'm surprised typing it in the console works: the insertSnippet command should take a package relative path, such as "insertSnippet Packages/LaTeX/Cases.sublime-snippet". It's case-sensitive, so that may be biting you.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Insert snippet from menu

Postby Marciano on Tue Oct 06, 2009 3:34 pm

I must have been asleep at the keyboard ;-) Of course you are right: it doesn't work even from the console, and the menu item is dimmed. Providing the package-relative path as per your suggestion fixed things! I'll upload the change with the next commit. Thanks!
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 3 guests