Skip to content

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

License

Notifications You must be signed in to change notification settings

parthapal33/atom-ternjs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atom-ternjs

Javascript code intelligence for atom with Tern. Uses suggestion provider by autocomplete-plus.

Installation

Make sure Node.js is installed and the PATH variable is set.
Make sure GIT is installed and the PATH variable is set.

Configure your project

  • Navigate to Packages -> Atom Ternjs -> Configure project
  • The config view appears.
  • Hit "Save & Restart Server" to create/update the .tern-project file

Configure project doesn't support the plugins-section (yet). Please add plugins manually by editing the .tern-project file as shown below

If configure project does not work for you

If a root file named .tern-project is not found ~/.tern-config serves as a default.

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

{
  "ecmaVersion": 6,
  "libs": [
    "browser",
    "jquery"
  ],
  "loadEagerly": [
    "absolute/or/relative/path/to/your/js/**/*.js"
  ],
  "dontLoad": [
    "absolute/or/relative/path/to/your/js/**/*.js"
  ],
  "plugins": {
    "complete_strings": {},
    "node": {},
    "lint": {},
    "angular": {},
    "requirejs": {},
    "es_modules": {},
    "doc_comment": {
      "fullDocs": true
    }
  }
}

EcmaVersion

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

Libs

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

Options

  • loadEagerly: provide the path to your projects js. Absolute path is recommended, but not necessary. (For relative path do not use ./ as a prefix. This sometimes leads to an unexpected behaviour)
  • dontLoad: can be used to prevent Tern from loading certain files. It also takes an array of file names or glob patterns.

Plugins

  • complete_strings: When enabled, this plugin will gather (short) strings in your code, and completing when inside a string will try to complete to previously seen strings. Takes a single option, maxLength, which controls the maximum length of string values to gather, and defaults to 15. (optional)
  • doc_comment: tern will look for JSDoc-style type declarations. Returns the full comment text instead of the first sentence. (optional)
  • node: NodeJS (optional)
  • lint: angelozerr/tern-lint is a tern plugin which is able to validate JavaScript files to collect semantic errors. Linter is used to display these errors and warnings (optional)
  • angular: AngularJS (optional)
  • requirejs: RequireJS (optional, understand RequireJS-style dependency management)
  • For a list of possible plugins goto http://ternjs.net/doc/manual.html#plugins

.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, via strg+space or can be forced in any context with ctrl+alt+space)

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 shortcut ctrl+shift+r) Click any item in the generated reference-list and navigate directly to file and position

atom-ternjs

  • Documentation (displayed if a suggestion with a valid documentation is selected in the 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 shortcut ctrl+alt+d)
  • Back from definition ctrl+alt+z
  • Rename variable (set your cursor position to a variable -> open context-menu and trigger "Rename" or use the shortcut ctrl+alt+c)

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 94.1%
  • CSS 5.9%