Autocomplete for Node.js (Probably Ternjs issue)



I’m using Atom Ternjs plugin for code intelligence and autocomplete.

Here’s my problem. When I “call” an external file rather than full module (from node_modules), I can’t access its properties. How can I fix it?

Note : I only included the changes I’ve made to my Node.js app.


var io = require('')();
module.exports = io;


var io = require('../io');


var io = require('./io');

When I type io and put a dot, (io.) while I’m in app.js , it should recognize socketio and show me “on”, but it doesn’t. The same thing applies to emit (io.emit).


There’s only so much static analysis (as I understand it, Tern.js is a static analysis tool) can do for a dynamically typed language like JavaScript. In order to know what require('')(); is returning, the code would have to be executed. That’s typically where static analysis tools draw the line :grinning: