Reputation: 2877
In the new VS Code editor, let's say I have two javascript files foo.js
and bar.js
with bar.js
containing this:
module.exports.sayBar = function () {
console.log('bar')
}
In foo.js
, if I type require('./bar').
and hit ctrl+space
to activate intellisense, it doesn't detect that one of the methods in the module is sayBar()
(I already have the default jsconfig.json
file that VS Code asks if you want to generate).
Is there some other configuration step to activate intellisense for other JS files that I've written? I really liked that feature for C++ projects in VS Express and it would cause VS Code to blow Atom completely out of the water IMO.
Upvotes: 1
Views: 838
Reputation: 5035
It does work for CommonJS modules. In your example it should be:
exports.sayBar = function() {
console.log('bar');
};
or
module.exports = {
sayBar: function() {
console.log('bar');
}
};
Upvotes: 1