Is there any tool for javascript commenting as it is in c# like ghost doc.
/// <summary>
/// Method to calculate distance between two points
/// </summary>
/// <param name="pointA">First point</param>
/// <param name="pointB">Second point</param>
function calculatePointDistance(pointA, pointB)
{
...
}
there any tool to automatically add the comments like above. like in c# code ghost doc did:
/// <summary>
/// Method to calculate distance between two points
/// </summary>
/// <param name="pointA">First point</param>
/// <param name="pointB">Second point</param>
private void calculatePointDistance(pointA, pointB)
{
.....
}
i want to do the similar in Client side ,javascript
Yes (but more like Javadoc) - look at JSDoc
Basically you use Javadoc-like special syntax in your comments e.g. @param
like in the following example and then parser will generate good looking HTML output for you
/**
* Shape is an abstract base class. It is defined simply
* to have something to inherit from for geometric
* subclasses
* @constructor
*/
function Shape(color){
this.color = color;
}
The short answer is no, there is nothing that automates the documentation. The closes you get is manually adding comments with something like jsdoc-toolkit that allows building the documentation into html pages.
There is intellisense documentation for javascript for javascript as well, which looks like this (notice it is inside the function though)
function example(var myParameter){
/// <summary>This is an example function</summary>
/// <param name="myParameter" type="String">All your string are belong to us.</param>
/// <returns type="Boolean" />
return !!myParameter;
}
You can also create snippets for javascript files. I would just create a few snippets filling out common documentations (any type you prefer) and then you can just type the snippet and it will fill in most of the documentation for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With