Working with JSDoc

The JSDoc functionality allows you to parse inline documentation for JavaScript source code in your project. The Documentation view shows the documentation of the JavaScript code including the parameters, returns, and exceptions. These are defined using tags ('@' - attributes). This documentation will also be added to functionalities such as Content Assist.

For more information on JSDoc see the JSDoc documentation (external link).

Opening the Documentation View

This procedure describes how to open the Documentation view, allowing you to use its functionality. The JSDoc functionality is only available for JavaScript files.

To open  the Documentation view:

  1. Open a JavaScript file by going to File | New | JavaScript File.
    The "New JavaScript File" dialog opens.

  2. After selecting the parent folder for your file, enter a name in the "File name" text field and click Finish.  
    A JavaScript file opens in the editor.

  3. Go to Window | Show View | Other  | JavaScript | Documentation and press OK.
    The Documentation view appears.

JSDoc allows you to add comments to your JavaScript code and makes the comments available in the Documentation view and in functionalities such as Content Assist.


Adding JSDoc Comments

This procedure describes how to add JSDoc Comments to JavaScript functions.

To add a JSDoc Comment:

  1. In the line above the code for the JSDoc function, enter the JSDoc characters '/**' and press Enter.

  2. Use the JSDoc tags to describe the properties of the JavaScript function (parameters, method, exceptions, etc.).

  3. End the code for the JSDoc function with the standard '*/'

JSDocs View

A JSDoc Comment will be created with the properties appearing in the Documentation View and in functionalities such as Content Assist. Whenever you use a function previously defined by the JSDoc tool, the properties will appear in the Documentation view.

When you use the previously defined JavaScript function, you can see the JSDoc documentation in the Documentation view by highlighting the function.