Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans javascript comments

I recently discovered that Netbeans really likes javascript comments which are formatted like this:

/**
 * This is a sample comment
 * 
 * @param {Number} myParam info about this parameter
 * @return {String} Returns some sample string.
 */
function sample(info) { .. }

This appears to be Javadoc compatible comments, but is it? Is there a resource somewhere which defines what formatting as acceptible? Also, is this style of commenting common to other IDE's such as Eclipse?

Edit: I have uploaded this screenshot to illustrate how Netbeans interprets @param and @return

enter image description here

Thanks.

like image 377
Steve Avatar asked Jun 13 '11 16:06

Steve


People also ask

How do I comment out a block in NetBeans?

If we want to comment out a block of code in NetBeans IDE, we can simply use [ctrl]+[shift]+[c] .

Does JavaScript work on NetBeans?

The NetBeans JavaScript editor provides syntax highlighting, autocompletion, and code folding, pretty much as you'd expect. The JavaScript editing features also work for JavaScript code embedded in PHP, JSP, and HTML files.


2 Answers

Comment tags are similar to JSDoc3, but not all JSDoc3 tags are supported. Some tags are missing in JSdocs 3 (they have no references in the list below).

You can see which are available this way:

  • start a comment with /** and push Enter;
  • inside a comment type @;
  • call code completion after @ sign with Ctrl + Space (Netbeans).

It will show you the list of supported tags and help with its syntax (parameters autocompletion). More tags are expected to be supported in future Netbeans releases as multiple bug reports are issued by users.

Here is the list of supported tags as for Netbeans 7.4:

  • @argument // Define argument type, name and description.
  • @augments // This object adds onto a parent object.
  • @author // Identify the author of an item.
  • @borrows // This object uses something from another object.
  • @class // Use the following text to describe the entire class.
  • @constant // Document an object as a constant.
  • @constructor // This function is intended to be called with the "new" keyword.
  • @constructs // This function member will be the constructor for the previous class.
  • @default // Document the default value.
  • @deprecated // Document that this is no longer the preferred way.
  • @description // Describe a symbol.
  • @extends // Type object is inherited from.
  • @field // A field.
  • @fileoverview // Describe a file.
  • @function // A function.
  • @ignore // [todo] Remove this from the final output.
  • @inner // Document an inner object.
  • @lends // Document properties on an object literal as if they belonged to a symbol with a given name.
  • @link // Inline tag - create a link.
  • @memberof // This symbol belongs to a parent symbol.
  • @name // Document the name of an object.
  • @namespace // Document a namespace object.
  • @param // Document the parameter to a function.
  • @private // This symbol is meant to be private.
  • @property // Document a property of an object.
  • @public // This symbol is meant to be public.
  • @requires // This file requires a JavaScript module.
  • @return // Return.
  • @returns // Document the return value of a function.
  • @see // Refer to some other documentation for more information.
  • @since // When was this feature added?
  • @static // Document a static member.
  • @syntax // Explain a syntax.
  • @throws // Describe what errors could be thrown.
  • @type // Document the type of an object.
  • @version // Documents the version number of an item.
like image 63
Zon Avatar answered Sep 22 '22 14:09

Zon


This style of comments is for JSDoc.

It is similar to JavaDoc but has some differences.

You can find out more at https://github.com/jsdoc/jsdoc

like image 32
Alan Geleynse Avatar answered Sep 22 '22 14:09

Alan Geleynse