atom-ternjs

JavaScript code intelligence for atom with tern.js and autocomplete-plus

Subscribe to updates I use atom-ternjs


Statistics on atom-ternjs

Number of watchers on Github 612
Number of open issues 107
Average time to close an issue about 2 months
Main language CoffeeScript
Average time to merge a PR 5 days
Open pull requests 11+
Closed pull requests 2+
Last commit about 1 year ago
Repo Created over 3 years ago
Repo Last Updated 3 months ago
Size 623 KB
Organization / Authortststs
Latest Releasev0.18.0
Contributors14
Page Updated
Do you use atom-ternjs? Leave a review!
View open issues (107)
View atom-ternjs activity
View on github
Latest Open Source Launches
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating atom-ternjs for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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):

{
  "ecmaVersion": 6,
  "libs": [
    "browser"
  ],
  "loadEagerly": [
    "path/to/your/js/**/*.js"
  ],
  "dontLoad": [
    "node_modules/**",
    "path/to/your/js/**/*.js"
  ],
  "plugins": {
    "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

  • 5: use ECMAScript5
  • 6: use ECMAScript6 (default)
  • 7: use ECMAScript7

Libs

  • browser: completion for vanilla js (optional)
  • jquery: completion for jQuery (optional)
  • underscore: completion for underscore (optional)
  • chai: completion for chai (optional)

Options

  • loadEagerly: provide the path to your projects js. For relative paths do not use ./ as a prefix. This sometimes leads to an unexpected behaviour.
  • loadEagerly is expensive. Do not add paths like node_modules.
  • dontLoad: can be used to prevent Tern from loading certain files. It also takes an array of file names or glob patterns.

Plugins

  • For a list of build in server plugins, visit: http://ternjs.net/doc/manual.html#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:

{
  "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:

(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

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

Restart Atom.

.tern-project created/modified

  • After the file was created or has been modified, restart the server via Packages -> Atom Ternjs -> Restart server

Features

  • Completion (autocompletion triggers automatically), or via the keybindings:
    • ctrl+space
    • ctrl+alt+space (force autocompletion in any context)

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

  • Documentation

    • Show documentation for the thing under the cursor via alt+o (macOS, Windows, Linux) atom-ternjs
    • Also displayed if a suggestion with a valid documentation is selected in the autocomplete-plus select-list
  • Find definition (set your cursor position to one of variable, function or instance -> open context-menu and trigger Find definition) or use the keybindings:

    • cmd+click (macOS, Windows, Linux), requires https://atom.io/packages/hyperclick. Since cmd+click is also used for multi-line editing in macOS you should change the default hyperclick settings.
    • ctrl+alt+shift+d (macOS, Windows, Linux)
  • Navigate back or forward

    • ctrl+shift+cmd+left (macOS, Windows, Linux)
    • ctrl+shift+cmd+right (macOS, Windows, Linux)
  • Rename variable (set your cursor position to a variable -> open context-menu and trigger Rename) or use the keybindings:

    • ctrl+alt+c (macOS, Windows)
    • ctrl+alt+shift+c (Linux)
atom-ternjs open issues Ask a question     (View All Issues)
  • over 1 year ternjs for phaser support dosen't work after install other snippets
  • over 1 year Can not Install ternjs
  • over 1 year Integration with Hyperclick
  • over 1 year Uncaught TypeError: Type is not a constructor
  • over 1 year Es6 suggestions missing
  • over 1 year Urgent : Major bugs introduced in 0.15
  • almost 2 years Missing Documentation information
  • almost 2 years Uncaught Error: Invalid package /Applications/ReQLPro.app/Contents/Resources/app.asar/node_module...
  • almost 2 years How to setting nodejs autocomplete?
  • almost 2 years Uncaught SyntaxError: Error parsing $ATOM_HOME/packages/atom-ternjs/node_modules/minimatch/node_m...
  • almost 2 years Uncaught NotSupportedError: Failed to execute 'registerElement' on 'Document': Registration faile...
  • almost 2 years child process error: Error: channel closed
  • almost 2 years Reveal folder on tree view on click on a require / import path
  • about 2 years Uncaught Error: Cannot find module './atom-ternjs-config-view'
  • about 2 years dontLoad is broken with loadEagerly
  • about 2 years Ternjs not working after upgrade to 0.14.1 when open an old folder with .tern-project file
  • about 2 years Renaming issues
  • about 2 years fuzzy matching
  • about 2 years Uncaught TypeError: this.resolves[e.id] is not a function
  • about 2 years Webpack: This plugin works only in a CommonJS environment
  • about 2 years Problems with ES6 and React jsx
  • about 2 years How to modify the text to Chinese?
  • about 2 years lint doesn't work
  • about 2 years Deal with duplicate declarations
  • about 2 years There is suggestions to canvas?
  • over 2 years Uncaught TypeError: config.libs.slice is not a function
  • over 2 years Uncaught TypeError: r.propagate is not a function
  • over 2 years Do not show Rename command on grammrs other from javascript
  • over 2 years Atom editor freezes up or becomes unresponsive
  • over 2 years Uncaught Error: Cannot find module 'acorn'
atom-ternjs open pull requests (View All Pulls)
  • Fix conflicts with built in function snippet
  • Fix a typo
  • fix 2 minor issues in current master
  • Fix selector in keymap file
  • 3-rd party tern modules got incorrect tern directory
  • Delay activation until needed
  • Restart child process on error
  • Add hyperclick support
  • Fix deprecation warnings
  • added error logging for uncaught exceptions from workers
  • remove keybindings documentation
atom-ternjs list of languages used
atom-ternjs latest release notes
v0.18.0 v0.18.0

[0.18.0]

  • destroy the tern server if there is no text-editor associated with it
  • a tern server now is forked for files not within a project. this is a WIP
  • reduce the files requests to the server per file to 1 instead of requesting it every time an update is requested
  • type now uses cached view-data as long as the cursor is inside the same method call
  • updated tern to 0.21.0
  • less error spamming through the console
  • minor memory optimizations
  • check if pending requests exceed a specific limit and restart the server if this limit is reached
  • rewritten configure project
  • configure project now is displayed via a pane
  • fixed deactivation / activation of package
  • rename now uses a modal instead a bottom panel
v0.17.2

[0.17.2]

  • fix marker (inline function completion) not being destroyed correctly
v0.17.1

[0.17.1]

  • fix IDBStore errors by not storing an reference to the view inside the marker
  • add JavaScript (JSX) to grammars
  • the package now gets activated if configure project is triggered
  • fix spamming errors and breaking autocomplete-plus if update is triggered on an unnamed/unsaved file by rejected the promise
  • Hyperclick action opens an empty file in multiproject workspace. thx @Sysoev
  • When ternjs webpack plugin in use, and we query for a definition the response contains absolute path. thx @Sysoev
Other projects in CoffeeScript