0

How can I add valid JSDoc comments inside functions? Is there a jsconfig.json setting I can use? E.g.

// Doesn't work inside vscode
function arrayMove(index) {
  /**
   * @param {Number} index
   * @return {Array}
   */
  // ...
}

instead of

// Works inside vscode
/**
 * @param {Number} index
 * @return {Array}
 */
function arrayMove(index) {
  // ...
}
starball
  • 20,030
  • 7
  • 43
  • 238
Ricky Boyce
  • 1,772
  • 21
  • 26

1 Answers1

0

As far as I know, there's no VS Code setting that makes it understand JSDoc comments inside functions rather than outside-and-before them. (From doing a simple search of VS Code's settings which include "jsdoc" in their names).

And from JSDoc's intro docs, I'm getting the impression that that wouldn't be valid JSDoc anyway:

JSDoc comments should generally be placed immediately before the code being documented.

From a quick skim of JSDoc's configuration docs and commandline argument docs, I didn't see anything that looked like such a setting at the JSDoc level either (if something's not supported/valid in JSDoc, I wouldn't expect it to be supported/valid VS Code's JSDoc IntelliSense either).

I'm guessing you're coming from Python? I say just get used to it.

starball
  • 20,030
  • 7
  • 43
  • 238