Optimal JSDoc annotations for JS code completion

I have a large JS project with namespacing and inheritance. I'm looking for some tips for the optimal JSDoc annotations to use to get code completion working in IDEA 12.

Here are some quick classes for demonstration.

// ...namespace setup here...

 * @class ClassA
com.demo.jstest.ClassA = function ClassA() {
    this.functionOnClassA = function() {};
// ...namespace setup here...

 * @class ClassB
 * @extends ClassA
com.demo.jstest.ClassB = function ClassB() {
    // ...inheritance setup here...

    this.functionOnClassB = function() {};
// ...namespace setup here...

 * @param {ClassA} classAInstance
 * @param {ClassB} classBInstance
 * @class Client
com.demo.jstest.Client = function Client(classAInstance, classBInstance) {
    // Want to use code completion here

In Client, code completion works as expected for the direct members of each class; i.e. classAInstance has functionOnClassA and classBInstance has functionOnClassB. But classBInstance does not have functionOnClassA, despite the @extends annotation.

If I replace all of the class names in the JSDoc annotations with fully-qualified names (i.e. com.demo.jstest.ClassA, com.demo.jstest.ClassB, etc.), the code completion does start including functionOnClassA on the classBInstance.

Do I really need to put fully-qualified names everywhere in my JSDoc annotations, or can I use some other combination of JSDoc tags to get the desired result?

1 comment
Comment actions Permalink

Hi Bruce,
I couldn't think of workaround for your situation rather than using of fully-qualified names. Please create a request in our tracker and provide a link to this topic there.



Please sign in to leave a comment.