0

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?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
vir us
  • 9,920
  • 6
  • 57
  • 66

1 Answers1

2

Why not using @property for this? Like:

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

class MyClass{}
lena
  • 90,154
  • 11
  • 145
  • 150