Комментарии к javascript 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?
Edit: я загрузил этот скриншот, чтобы проиллюстрировать, как Netbeans интерпретирует @param и @возврате

спасибо.
4 ответов
этот стиль комментарии для JSDoc.
Он похож на JavaDoc, но имеет некоторые различия.
вы можете узнать больше на http://code.google.com/p/jsdoc-toolkit/
Теги комментариев похожи на jsdoc3, но не все теги JSDoc3 поддерживаются. Некоторые теги отсутствуют в JSdocs 3 (у них нет ссылок в списке ниже).
вы можете увидеть, которые доступны таким образом:
- начните комментарий с / * * и нажмите Enter;
- внутри типа комментария@;
- завершение кода вызова после @ sign с помощью Ctrl + Space (Netbeans).
он покажет вам список поддерживаемых тегов и справка по его синтаксису (параметры автозаполнения). Ожидается, что в будущих выпусках Netbeans будет поддерживаться больше тегов, так как пользователи выпускают несколько отчетов об ошибках.
вот список поддерживаемых тегов для 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. -
@
// Describe a symbol. - @extends
// Type object is inherited from. - @поле
// 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. -
@требует
// 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.
вообще стандарты документации место вашей организацией или клиентом. Если нет, я склонен следовать общему стандарту, подобному тому, что вы найдете в netbeans.
это не важно. Все между /* и */ комментируется. Netbeans просто делает его лучше, добавив * на каждой строке. Точка, в Java и Javascript, вы можете прокомментировать либо /* ... */-multiline или // ... - одиночная строка, тогда как в CSS, например, вы можете использовать только /* ... */.