0

I cannot seem to annotate a class so that its methods are know to the WebStorm editor.

Here is the example:

/**
 * @class my class
 * @constructor
 */
function MyClass() {
    this.aPublicField = "foo"
    var aPrivateField = "bar"

    this.aPublicMethod = function() {}
    var aPrivateMethod = function() {}
}

/**
 * @param {MyClass} aClass
 */
function doSomething(aClass) {
    aClass.aPublicMethod() <----- "Unresolved function or method"
}

The Java-like syntax should be correct.. I guess. Am I doing something wrong in the annotations?

fusio
  • 3,595
  • 6
  • 33
  • 47

1 Answers1

0

Documentation seems to be correct and code highlights fine for me in WebStorm 6.0.2a and the latest 7 EAP. I think your problem can be related to issue WEB-7548. We considered the word following @class tag to be the class name and properties were attached to the wrong class, so as a workaround now you could move class description somewhere from @class tag, or as a better alternative download latest WebStorm 7 EAP.

de1mar
  • 1,176
  • 10
  • 6
  • WebStorm 7 fixes the issue. I guess it is not only the class, but the fact that the class is declared inside a module which is passed into another module as argument... and then used there. Not sure why but even using `moduleName.MyClass` (with both `moduleName` and `MyClass` correctly linking to their objects) did not solve the issue.. with WebStorm 7 simply using `MyClass` seem to work. – fusio Aug 12 '13 at 09:28