Netbeans javascript评论

Ste*_*eve 14 javascript comments netbeans

我最近发现Netbeans真的很喜欢javascript注释,其格式如下:

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

这似乎是Javadoc兼容的评论,但是呢?是否有某个资源将某些格式定义为可加性?此外,这种评论风格是否与其他IDE(例如Eclipse)相同?

编辑:我上传了这个截图,以说明Netbeans如何解释@param和@return

在此输入图像描述

谢谢.

Zon*_*Zon 13

注释标记与JSDoc3类似,但并非所有JSDoc3标记都受支持.JSdocs 3中缺少一些标记(它们在下面的列表中没有引用).

您可以通过这种方式查看哪些可用:

  • 用/**开始评论并按Enter键;
  • 在评论类型@;
  • 使用Ctrl + Space(Netbeans)在@符号后调用代码完成.

它将显示支持的标记列表并帮助其语法(参数自动完成).由于用户发布了多个错误报告,预计未来的Netbeans版本将支持更多标签.

以下是Netbeans 7.4支持的标签列表:

  • @argument // Define argument type, name and description.
  • @augments // This object adds onto a parent object.
  • @作者 // Identify the author of an item.
  • @borrows // This object uses something from another object.
  • @类 // Use the following text to describe the entire class.
  • @不变 // Document an object as a constant.
  • @constructor // This function is intended to be called with the "new" keyword.
  • @结构体 // This function member will be the constructor for the previous class.
  • @默认 // Document the default value.
  • @deprecated // Document that this is no longer the preferred way.
  • @描述 // Describe a symbol.
  • @extends // Type object is inherited from.
  • @领域 // A field.
  • @fileoverview // Describe a file.
  • @功能 // A function.
  • @忽视 // [todo] Remove this from the final output.
  • @内 // Document an inner object.
  • @lends // Document properties on an object literal as if they belonged to a symbol with a given name.
  • @链接 // Inline tag - create a link.
  • @成员 // This symbol belongs to a parent symbol.
  • @名称 // Document the name of an object.
  • @namespace // Document a namespace object.
  • @param // Document the parameter to a function.
  • @私人的 // This symbol is meant to be private.
  • @属性 // Document a property of an object.
  • @上市 // This symbol is meant to be public.
  • @requires // This file requires a JavaScript module.
  • @返回 // Return.
  • @Returns // Document the return value of a function.
  • @看到 // Refer to some other documentation for more information.
  • @以来 // When was this feature added?
  • @静态的 // Document a static member.
  • @句法 // Explain a syntax.
  • 抛出: // Describe what errors could be thrown.
  • @类型 // Document the type of an object.
  • @版 // Documents the version number of an item.


Ala*_*nse 9

这种评论风格适用于JSDoc.

它类似于JavaDoc但有一些差异.

您可以在http://code.google.com/p/jsdoc-toolkit/上找到更多信息.