我在我的javascript代码中成功使用intellisense功能,但我不知道如何让它为var工作,或者我应该以不同的方式设计这个类,以便我可以有效地记录它。
(function ($)
{
$.myNamespace.MyClass = {
m_varIWantToCommentOn: null,
/// <summary locid="m_varIWantToCommentOn">
/// *This doesn't work here* How should I comment on what this var is for?
/// </summary>
Init: function ()
{
/// <summary locid="Init">
/// Called when MyClass is initialized for the first time. this comment works fine.
/// </summary>
// ...use m_varIWantToCommentOn in some way...
}
}
})(jQuery);
答案 0 :(得分:1)
我知道这个问题有点陈旧,但万一其他人有同样的问题......
我会使用<field>
标记。它超越了它描述的领域,与内部的功能文档不同。
(function ($) {
$.myNamespace.MyClass = {
/// <field> comments here </field>
m_varIWantToCommentOn: null,
Init: function () {
/// <summary locid="Init">
/// Called when MyClass is initialized for the first time. this comment works fine.
/// </summary>
// ...use m_varIWantToCommentOn in some way...
}
}
})(jQuery);
通常,<var>
标记仅用于var声明,但它们也高于它们描述的var。
/// <var>comments here</var>
var someVar = null,
/// <var>This is a number</var>
anotherVar = 0;