Code completion not work for case @memberOf
How to reproduce:
//file A.js
/**
* @memberOf module:type
* @property {string} B
*/
class A {
static test() {}
}
module.exports = A;
//client file
const A = require("./A");
A.test(); //Unresolved function or method test()
let x = A.B; //Unresolved variable B
if i remove memberOf all is ok, but i need modules for jsdoc
workaround is to add /** @class module:type.A */ before require, but it's not good
Please sign in to leave a comment.
Logged as https://youtrack.jetbrains.com/issue/WEB-36477, please follow it for updates
Hi, found another case:
in some module M (index.js):
/**
* @memberOf module:type
*/
class A {
test() {}
}
in project:
const A = require("M");
/**
* @memberOf module:any
*/
class B extends A {
}
const b = new B;
b.test() // no code completion
code completion only woks if i add to class B jsdoc: @extends module:type.A
works for me using similar code:
hmm, here is a little bit more complex example of this
https://github.com/imsamurai/phpstorm-jsdoc-test-app
it works if you add
to A.js:
hmm, thanks! Some time ago i had some problems if many files contain
but i don't remember which exactly)
Now seems all ok, jsdoc successfully generates and phpstorm code completion works normally.
Your suggestion results in duplicate class descriptions in jsdoc generated html
So i think it's logical that distinct @module must be in one file and other module members should use @memberOf
so solution is write
module.exports.A = require("./A");
instead of:
module.exports = { A: require("./A") };