Hello all,
-
Can I use JSON for writing snippets?
-
How can I make the description as on the screenshot?
Hello all,
Can I use JSON for writing snippets?
How can I make the description as on the screenshot?
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.
<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>
[quote=“tstrokes”]
2. How can I make the description as on the screenshot?
Currently this is the XML structure of a snippet.
<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>
[/quote]
I know that. I wrote this viewtopic.php?f=5&t=1639 snippets
I’m wondering what is circled in red on the screenshot
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.
The .sublime-snippet format may be changed during the alpha, but I don’t know for sure at this stage.