Search code examples
node.jscode-completioncommonjsjsdocwebstorm

jsdoc for commonjs require


I use webstorm ide with nodejs. When I create modules and require them, I don't have code completion.

For example:

test.js

/** @module test*/
module.exports = {
    run: function () {}
};

main.js

var test = require(__dirname+"/test.js");
test. //code completion does not offer "run"

I haven't found anything about module usages in jsdoc 3 documentation yet. :S


Solution

  • var test = require("./test.js");
    test. //code completion offers "run"
    

    So you have to use "." instead of __dirname.