admin管理员组

文章数量:1410712

Is it possible, preferably, in Sublime Text or Webstorm, to type in a JSDoc-style ment, like so:

/**
 * Repeat <tt>str</tt> several times.
 * @param {string} str The string to repeat.
 * @param {number} times How many times to repeat the string.
 * @returns {string}
 */

And generate a function definition like so:

function repeat (str, times) {
    return
}

?

A vice-versa operation is fine too, I'm just looking for a way to save on extra keystrokes.

Is it possible, preferably, in Sublime Text or Webstorm, to type in a JSDoc-style ment, like so:

/**
 * Repeat <tt>str</tt> several times.
 * @param {string} str The string to repeat.
 * @param {number} times How many times to repeat the string.
 * @returns {string}
 */

And generate a function definition like so:

function repeat (str, times) {
    return
}

?

A vice-versa operation is fine too, I'm just looking for a way to save on extra keystrokes.

Share Improve this question edited Oct 25, 2013 at 13:12 user1228 asked Jun 18, 2013 at 17:06 pilaupilau 6,7534 gold badges59 silver badges70 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

It would appear that sublime-jsdocs is just what you're looking for for ST2. Scroll down a bit and you'll even see animated GIFs demonstrating automatic documentation creation from function definitions. It can be installed via Package Control.

I don't use Webstorm, but a quick Google search would seem to indicate that JSDoc functionality is already built-in, although it doesn't look as nifty as Sublime's, which has a bunch of config options, is more flexible, and doesn't require running a bloated IDE :)

sublime-jsdocs is what u need. Use this link to install it in sublime through Package Control

本文标签: javascriptGenerate a function definition from a JSDoc comment (or viceversa)Stack Overflow