Home Download Buy Blog Forum Support

Description of the snippet usage

Description of the snippet usage

Postby squ1b3r on Mon Feb 14, 2011 6:18 am

Hello all,

1. Can I use JSON for writing snippets?

2. How can I make the description as on the screenshot?
Attachments
Screen shot 2011-02-14 at 11.00.59 AM.png
Screen shot 2011-02-14 at 11.00.59 AM.png (41.46 KiB) Viewed 1669 times
squ1b3r
 
Posts: 45
Joined: Fri Feb 11, 2011 6:35 am

Re: Description of the snippet usage

Postby tstrokes on Mon Feb 14, 2011 6:05 pm

1. Can I use JSON for writing snippets?
As far as I can tell snippets in both ST 1.4 and ST 2 snippets are in XML.
However, I do remember reading somewhere that they will eventually be JSON.

2. How can I make the description as on the screenshot?
Currently this is the XML structure of a snippet.
Code: Select all
<snippet>
    <content><![CDATA[if (${1:true}) {${0:$TM_SELECTED_TEXT}};]]></content> <!-- The text to insert. -->
    <tabTrigger>if</tabTrigger> <!-- Sublime parses this and displays it in the snippet menu as "i,f, Tab" this is what you are looking for. -->
    <scope>source.js</scope> <!-- the scope of the snippet -->
    <description>if</description> <!-- [Option] Add this to customize the description in the left hand portion of the snippet menu. Defaults to the name of the snippet file if missing. -->
</snippet>
tstrokes
 
Posts: 17
Joined: Wed Dec 03, 2008 6:39 pm

Re: Description of the snippet usage

Postby squ1b3r on Mon Feb 14, 2011 8:33 pm

tstrokes wrote:2. How can I make the description as on the screenshot?
Currently this is the XML structure of a snippet.
Code: Select all
<snippet>
    <content><![CDATA[if (${1:true}) {${0:$TM_SELECTED_TEXT}};]]></content> <!-- The text to insert. -->
    <tabTrigger>if</tabTrigger> <!-- Sublime parses this and displays it in the snippet menu as "i,f, Tab" this is what you are looking for. -->
    <scope>source.js</scope> <!-- the scope of the snippet -->
    <description>if</description> <!-- [Option] Add this to customize the description in the left hand portion of the snippet menu. Defaults to the name of the snippet file if missing. -->
</snippet>


I know that. I wrote this viewtopic.php?f=5&t=1639 snippets

I'm wondering what is circled in red on the screenshot
squ1b3r
 
Posts: 45
Joined: Fri Feb 11, 2011 6:35 am

Re: Description of the snippet usage

Postby jps on Tue Feb 15, 2011 3:54 am

Snippet key bindings are not shown in the menu on OS X, because Cocoa is unable to show multi-key key bindings in its menus. I plan to spend some time looking into doing menus the deprecated (Carbon) way on OS X in the future, as it's more flexible.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Description of the snippet usage

Postby squ1b3r on Tue Feb 15, 2011 5:54 am

jps wrote:Snippet key bindings are not shown in the menu on OS X, because Cocoa is unable to show multi-key key bindings in its menus. I plan to spend some time looking into doing menus the deprecated (Carbon) way on OS X in the future, as it's more flexible.


Tnx for the answer.

How about JSON format for snippets?
squ1b3r
 
Posts: 45
Joined: Fri Feb 11, 2011 6:35 am

Re: Description of the snippet usage

Postby jps on Tue Feb 15, 2011 6:18 am

The .sublime-snippet format may be changed during the alpha, but I don't know for sure at this stage.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 11 guests