Open ghost opened 9 years ago
@madhavan020985 I don't know how to fix your problem, but if you wish to benefit with express completion with tern, I suggest you that you use https://github.com/angelozerr/tern-node-express
debugging the above issue, i noticed in "require('express').Router", Router is a MemberExpression (a parsed structure of the code) and it belongs to the object 'express'. now, the object 'express' gets its value as
var express = require('express')
Since this logic is node specific, i am not sure how ternjs handles the properties that percolates down from module files. However, during execution inside tern.js#findDef, 'expr.state.props.express' object has the keys,
types,forward,maxWeight,propertyOf,originNode,origin
and obviously, this is missing 'Router' property. this leads to the error 'No Definition found'.
i found out 'expr.state.props.express' object is built through acorn.js & node plugin. i am not able to figure out which block in nodejs plugin handles this however? any help, please?
The properties you listed indicate that this is an infer.AVal
object, so you should not expect Router
to show up in there. The plugin Angelo linked appears to be a regular Tern plugin, so it should work with Emacs just fine.
i am using express module in my node application. here is the code flow from usage to the place where it is defined inside node_modules folder:::::
Tern in this case is not working. But i can see, there are many module layers involved making it tough for tern to resolve. But where does the chain get broken here? If more inputs on why tern didn't work in this case can be given, it will help me to use Tern better.... thanks marinjh.