Daniel Griscom Daniel Griscom - 16 hours ago 2
TypeScript Question

How do I view JSCode-generated documentation in Visual Studio Code?

I've been building an Angular 2/Typescript project in Visual Studio Code, and assiduously adding JSDoc comment blocks, but I'd now like to view the JSDoc output. I could install and set up my own JSDoc generation system, but given all the nice GUI support in VSC it seems reasonable to be able generate and view the JSDoc right from VSC.

My Google-Fu has been failing me; every time I look for "Generating JSDoc Output within Visual Studio Code" I just get plugins to generate JSDoc comment blocks.

Are there methods of generating and viewing JSDoc output within Visual Studio Code?

Answer

AFAIK there is no built in support, but I don't think it's necessary, as you could easily add a task that would run the appropriate jsdoc command. I don't know if this is what you mean by "setting up your own JSDoc generation system", but it's done quickly:

  1. First install the jsdoc generator from the terminal: npm install -g jsdoc (assuming you have node.js / npm).
  2. Decide which arguments you need for jsdoc (see http://usejsdoc.org/about-commandline.html)
  3. Set up a task (e.g. from the menu: Tasks -> Configure Tasks) - see https://code.visualstudio.com/Docs/editor/tasks for more info (you can even add a keyboard shortcut)
  4. Open the generated html-page with your JSDocs.