3

Is it possible to generate a JSDoc documentation in IDEA / WebStorm with one click, just like I do JavaDoc with IntelliJ IDEA.

Mike
  • 14,010
  • 29
  • 101
  • 161

1 Answers1

5

TL;DR:

enter image description here

To add a functionality of the JSDoc documentation generation to IntelliJ IDEA / WebStorm:

  1. Install jsdoc to the Node.js project: npm i jsdoc

  2. Prepare a JSDoc configuration file (jsdoc.json) and store it in the root of the project

  3. Go to File | Settings | Tools | External Tools in IntelliJ IDEA / WebStorm

  4. Add a new external tool called Generate JSDoc… of group Documentation.

  5. In Tool Settings provide the following parameters:

    • Program: path to the Node.js binary, e.g.: C:\Program Files\nodejs\node.exe

    • Arguments: path to JSDoc scripts and to the JSDoc config (jsdoc.json), e.g.: $ProjectFileDir$/node_modules/jsdoc/jsdoc.js -c $ProjectFileDir$/jsdoc.json
      Here it is possible either specify absolute paths or provide a relative path using IDE's internal command $ProjectFileDir$

    • Working directory: path to the sources, e.g.: $ProjectFileDir$\src

  6. Press OK and Apply

Now, go to Tools → Documentation → Generate JSDoc…, et voilà, the JSDoc is generated and stored according to the JSDoc config (jsdoc.json).

P.S. This guide is tested on IntelliJ IDEA 2021.2.

Mike
  • 14,010
  • 29
  • 101
  • 161