Hacker News new | ask | show | jobs
by ibabanov 3802 days ago
"Symbol and definition lookup is another great feature of WebStorm. While Emacs can find symbols and definitions in a single file via Tern, ..."

Actually, tern has tern-find-definition which works not only in a single file. You can jump in to other modules in your project or to node_modules. And there is tern-pop-find-definition to return back. For methods of native js objects tern even opens browser with related MDN page. But WebStorm way better in debugging, that's true.

2 comments

It's also worth noting that there's a lot of work going into Emacs right now to give it better IDE-like features -- finding definitions reliably, refactoring, all that stuff. They're working on a more generalized framework for supporting this stuff, and I'd expect Emacs to get significantly more competitive (with traditional IDEs) within the next year or two.
>Actually, tern has tern-find-definition which works not only in a single file.

I haven't been able to make this work outside my current file. Perhaps I'm just configuring tern wrong :(

This .tern-project config works for me:

  {
    "libs": [
      "browser"
    ],
    "plugins": {
      "node": {},
      "es_modules": {}
    }
  }
Your project files must have "correct" format, e.g. require('relative_path') for imports and module.exports/exports for exports (or es6 import and export). Example for AMD format (requireJS) can be found here - http://ternjs.net/doc/manual.html#configuration
I can't get it to search outside the standard node files using the above config. I can't get it to be aware of my code in the project.