Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 274
Daniel Griscom Avatar asked Dec 01 '16 16:12

Daniel Griscom


People also ask

How do you see release notes in VS Code?

If you'd like to read these release notes online, go to Updates on code.visualstudio.com. Watch the release party: Listen in as the VS Code team discusses some of the new features. You can find the recording of the event on our YouTube channel.

How do I see Markdown preview in VS Code?

Markdown preview To switch between views, press Ctrl+Shift+V in the editor. You can view the preview side-by-side (Ctrl+K V) with the file you are editing and see changes reflected in real-time as you edit.

How do you display VS Code output?

To display the Output window whenever you build a project, in the Options dialog box, on the Projects and Solutions > General page, select Show Output window when build starts.


2 Answers

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.
like image 110
Elmar Jansen Avatar answered Sep 24 '22 16:09

Elmar Jansen


The place I've found the jsdocs helpful within vscode is for intellisense.

Say I have this function

/**
 * This squares a function
 * @param x takes this value and doubles it
 */
function myAwesomeFunction(x: number) {
  return x *x;
}

Then vscode will show me this descriptive jsdocs whenever I try and call the function.

enter image description here

like image 33
seescode Avatar answered Sep 26 '22 16:09

seescode