如何在 Javascript 文件中编写自己的智能感知注释?

dol*_*ine 5 visual-studio-2012

在 C# 中,我可以在类或函数的定义之前添加 /// 开始的注释,这些注释会影响我编写使用该类型或函数的代码时显示的智能感知提示。但它在 JavaScript 中不起作用。我可以获得这些特别评论和额外提示吗?

Cyb*_*axs 2

不是很远,但是注释应该在js函数中。

这是一个例子:

function getArea(radius)
  {
      /// <summary>Determines the area of a circle that has the specified radius parameter </summary>
      /// <param name="radius" type="Number">The radius of the circle.</param>
      /// <returns type="Number">The area.</returns>
      var areaVal;
      areaVal = Math.PI * radius * radius;
      return areaVal;
  }
Run Code Online (Sandbox Code Playgroud)

您还可以在 MSDN 中找到HowTo文档