Last Updated: February 25, 2016
·
884
· balmasi

Sublime Text 2 javascript docstring snippet

I found myself constantly writing documentation for javascript functions and making that a nice looking comment block always wasted my time. Save this snippet as a file ending with a .sublime-snippet extension and put it in /Users/borna/Library/Application Support/Sublime Text 2/Packages/JavaScript/ (cause it makes sense to put it there)

<snippet>
    <content><![CDATA[
/**
 * ${1}
 *
 * @method ${2}
 * @param ${3}
 * @return ${4}
 */
    ]]></content>
    <tabTrigger>docstr</tabTrigger>
    <scope>source.js</scope>
    <description>Adds a docstring skeleton to a javascript function</description>
</snippet>

where * tabTrigger * is what you want to type before you press tab to expand the snippet. and scope.extention is the types of files (if not all files, when unspecified) you want this to be active on.

1 Response
Add your response

Then you might like the DocBlockr Plugin for ST2 :-)

over 1 year ago ·