For web development (and more), my favorite editor is the great atom editor, the open source project by github.
Like many code editors, we can extend it by installing a lot of plugins. Among others, I use atom-ternjs:
Javascript code intelligence for atom with tern.js. Uses suggestion provider by autocomplete-plus.
Today I get this error into a 'alert styled' flash message box in the editor window's top right corner:
TypeError: Cannot read property 'CallExpression' of undefined at findTypeFromContext.NewExpression (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/infer.js:1588:18) at Object.exports.typeFromContext (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/infer.js:1623:24) at Object.findCompletions [as run] (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:684:23) at run (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:218:30) at Object.exports.withContext (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/infer.js:774:18) at /home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:225:13 at analyzeAll (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:339:15) at doRequest (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:209:5) at Object.signal.mixin.request (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/lib/tern.js:149:7) at respond (/home/poremil/.atom/packages/atom-ternjs/node_modules/tern/bin/tern:224:10)
However, a didn't notice any specific bug in my workflow. That said, I would want to understand what happend.
I also opened an issue on the github project
Yes, this does look like a bug. Here is a simplified extract from the breaking code:
This breaks because of the this keyword.
var finder = findTypeFromContext['NewExpression'];
assignment takes NewExpression method "out" (detaching from the parent object).My quick-fix would be to immediately call the function on the object so this is still pointing at the right place: