vir us
vir us

Reputation: 10715

WebStorm: JavaScript code-complete for dynamically generated class methods

How to annotate a dynamically generated class method in WebStorm so it shows up in the autocomplete?

So far I was able to accomplish similar thing for properties:

/**
 * @property prop1
 * @property prop2
 */

class MyClass{
    //empty class
}

Now if I type new MyClass().pr then WebStorm shows both prop1 and prop2 in the code completion popup.

What is the correct syntax for methods?

It seems @name should do the trick, but WebStorm doesn't recognize it for autocompletion.

Or maybe it's not about annotations but there is a different way of accomplishing that?

Any IDEas?

Upvotes: 0

Views: 91

Answers (1)

lena
lena

Reputation: 93728

Why not using @property for this? Like:

/**
 * @property prop1
 * @property prop2
 * @property {function(string)} method1
 */

class MyClass{}

Upvotes: 2

Related Questions