Enable Javascript Intellisense for class instance with XML comment

How can I tell Visual Studio 2010 to recognize my variable as an instance of this class?

var myObjCls = function() { this.Hello = "World"; }; var anotherObjCls = function (myObj) { /// <param name="myObj" type="myObjCls"></param> myObj. // Hello is NOT available var myObjLocal = new myObjCls(); myObjLocal. // Hello is available } 

So my param XML document is not working. What am I doing wrong?

+4
source share
1 answer

You must first define the correct constructor (the class is not a valid member), like this ...

 function MyObject() { this.hello = "World"; } 

The agreement is to use a Pascal or UpperCamelCase package for constructors and a Camel package for variables, functions, etc.

The next step is to instantiate using this constructor.

 var myObj = new MyObject(); console.log(myObj.hello) 

I have not tested it in Visual Studio, but I am sure that if you follow the JS conventions, VS will understand what you are doing.

0
source

All Articles