Giter Club home page Giter Club logo

tern_for_sublime's Introduction

Tern for Sublime Text

This is a Sublime Text (version 2 and 3) package that provides Tern-based JavaScript editing support.

In JavaScript files, the package will handle autocompletion.

The following keys will be found (in JavaScript files):

alt+.
Jump to the definition of the thing that the cursor is pointing at. If there is no known code location, but it has a documentation URL associated with, this will open the documentation in your browser instead.

alt+,
Jump back to where you were when executing the previous alt+. command.

alt+space
When on a variable, select all references to that variable in the current file.

Installation

Check out the code in this repository into a subdirectory of your Sublime Text's Packages directory.

cd /path/to/sublime-text-N/Packages
git clone git://github.com/marijnh/tern_for_sublime.git

Next, make sure node.js and npm are installed (Tern is a JavaScript program), and install the depedencies of the package.

cd tern_for_sublime
npm install

You should be all set now.

Configuration

The plugin will load its settings from Preferences.sublime-settings, and recognized the following settings:

tern_argument_hints (boolean, defaults to false)
Whether to show argument hints. When enabled, the status bar will list the arguments for the function call that the cursor is inside. Unfortunately, the status bar is tiny and Sublime Text provides no saner way to show these hints. May impact responsiveness on slow machines or big projects.

tern_command (list of strings) The command to execute to start a Tern server. The default is ["node", "/path/to/Packages/tern_for_sublime/node_modules/tern/bin/tern"]. If your node installation lives somewhere that's not in the default path, or your Tern checkout is not where the module expects it to be, you'll want to manually set this option.

tern_arguments (list of strings) An extra set of arguments to pass to the Tern server. For example --no-port-file to suppress the creation of .tern-port files.

Tern uses .tern-project files to configure loading libraries and plugins for a project. See the Tern docs for details.

Automatically Showing Completions

Add {"selector": "source.js", "characters": "."} to your auto_complete_triggers preference array to automatically show completions after a dot is typed following an object name.

Example:

"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"}, {"selector": "source.js", "characters": "."} ]

Ensure that your auto_complete preference is set to true. It's enabled by default.

Alternative package

There exists also Sublime Tern, a package with similar goals (Tern integration for ST). It exposes a slightly different set of functionality, and uses the PyV8 bridge, rather than node.js, to run the Tern server.

tern_for_sublime's People

Contributors

gvn avatar marijnh avatar pahen avatar subhaze avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.