1

I am using WebStorm as my IDE of choice and write a lot of JavaScript. Autocompletion is nice but in the case of JavaScript there are still... thins left to improve... This is at least what I experienced.

For example

There are two classes, A and B:

/**
 * This is Doc of class A
 * @constructor
 */
A = function () {
    this.name = "Class A";
    this.data = {
        foo: "Foo!",
        bar: "Bar!"
    };
};

/**
 * @inheritDoc A
 * @augments A
 * @constructor
 */
B = function () {
    A.call(this);

    // this works fine in the application
    // but is not registered by WebStorm / IntelliJ
    this.data.braz = "Braz!"
};

B.prototype = Object.create(A.prototype);

var a = new A();
var b = new B();

My Probmem

In the IDE: when I start typing a. the autocompletion kicks in and displays data (A) and name (A).

But when I type b. first of all it did not display the values, only after I added the /** @augments A */. WebStorm did not get it without it.

But the main problem I have with it: when I type b.data. it won't offer me braz (B) as an option.

Does anybody have experience with JavaScript, @JSDoc, WebStorm / IntelliJ and knows a solution?


What I could do is to write duplicate code and copy the this.data object from above and add the attributes I need.

What I also could do is to bring the content of this.data up to this directly. But that is not what I want.

Thanks in advance!

Colja
  • 209
  • 1
  • 3
  • 11

0 Answers0