Atom Packages Directory

a package directory for a text editor of the 21st Century

Ternjs

Install with:
    apm install atom-ternjs
  

atom-ternjs

JavaScript code intelligence for atom with Tern. Adds support for ES5, ES6, ES7, Node.js, jQuery, Angular and more. Extendable via plugins. Uses suggestion provider by autocomplete-plus.

Installation

Configure your project * Open any JavaScript file from within your project * Navigate to Packages -> Atom Ternjs -> Configure project * The config view appears. * Hit “Save & Restart Server” to create/update the .tern-project file

Optional: * install the package https://atom.io/packages/hyperclick

If configure project does not work * In your project root create a file named .tern-project. See docs @ http://ternjs.net/doc/manual.html#configuration. * Restart the server via Packages -> Atom Ternjs -> Restart server

Example .tern-project file (customize to your own needs):

json { "ecmaVersion": 6, "libs": [ "browser" ], "loadEagerly": [ "path/to/your/js/**/*.js" ], "dontLoad": [ "node_modules/**", "path/to/your/js/**/*.js" ], "plugins": { "modules": {}, "es_modules": {}, "node": {}, "doc_comment": { "fullDocs": true, "strong": true } } }

In order to use third party plugins read the Third party plugins section!

In order to use third party plugins from within your project’s node_modules read the Third party plugins local section! This is also an alternative if Third party plugins aren’t working.

EcmaVersion

Libs

Options

Plugins

Keybindings

List of keybindings. To use your own keybindings goto atom-ternjs package settings and disable keybindings.

Third party plugins

In order to use third party plugins (e.g. tern-node-express): $ cd ~/.atom/packages/atom-ternjs $ npm install tern-node-express Add the plugin to your .tern-project file: json { "ecmaVersion": 6, "libs": [ "browser" ], "loadEagerly": [ "app/**/*.js" ], "plugins": { "node-express": {} } }

Third party plugins are still an issue and sometimes do not work as expected, especially if the plugin requires a tern version that does not match the tern version that is used by atom-ternjs.

Restart the server: Packages -> Atom Ternjs -> Restart server

Third party plugins local

Example for node-express. Open node_modules/tern-node-express/tern-express.js

Replace:

js (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS return mod(require("tern/lib/infer"), require("tern/lib/tern")); if (typeof define == "function" && define.amd) // AMD return define([ "tern/lib/infer", "tern/lib/tern" ], mod); mod(tern, tern); }...

With

```js (function(mod) { return mod(process.__infer, process.__tern); }…

```

Restart Atom.

.tern-project created/modified

Features

atom-ternjs

atom-ternjs * Find references (set your cursor position to one of variable, function or instance -> open context-menu and trigger “Find references” or use the keybindings: * ctrl+shift+r (macOS, Windows) * ctrl+alt+shift+e (Linux)

Click any item in the generated reference-list and navigate directly to file and position

atom-ternjs

Keywords: javascript, autocomplete-plus, autocomplete, node, es6, javascript-2015, jquery, tern Suggest keywords
Fork me on GitHub