Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues installing #123

Open
Orbyt opened this issue Jun 26, 2016 · 3 comments
Open

Having issues installing #123

Orbyt opened this issue Jun 26, 2016 · 3 comments

Comments

@Orbyt
Copy link

Orbyt commented Jun 26, 2016

The github readme specifies installation via going into /Roaming/ST3/Packages and git cloning this repo, followed by npm install.

Now I'm not sure if installing via the package manager accomplishes the same as above, but i've also tried doing that.

Sometimes when trying from a clean insall, ill get the following: http://prntscr.com/ble0nx

Going to that directly and manually initiating the npm install seems to go through successful, but I am unable to get basic autocomplete working. I also noticed it often doesnt show up in package settings.

So what is the basic install process here? What am I missing?

@zaynv
Copy link

zaynv commented Jul 2, 2016

  1. Install tern_for_sublime through Package Control.
  2. Navigate to the tern_for_sublime folder in your Packages Directory.
  3. Inside that folder, run npm install

And you should be good to go.

@Orbyt
Copy link
Author

Orbyt commented Jul 2, 2016

Does not seem to work. npm install seems to go through fine, but theres no autocomplete. If I go to Sublime Text and start typing "require" I would assume an autocomplete option should pop up right? Because it doesnt. Also, for some reason 2 different Tern options appear in settings: http://prntscr.com/bnzs3d

@zaynv
Copy link

zaynv commented Jul 2, 2016

There are two tern plugins for Sublime. One is under the name of TernJS in Package Control and one is tern_for_sublime which is this one. I would recommend only using this one and removing the other package if you have it installed as well.

There won't be autocompletion for require, you can look into installing some other package for that like Nodejs. Tern does provide autocompletion for most other things that aren't Node-specific. To test if its working, try doing

[].

And you should get a tooltip for the available methods you can do on an array like so:

screen shot 2016-07-02 at 2 58 59 pm

It can also infer types:

screen shot 2016-07-02 at 3 00 33 pm

and if you use JSDoc, it can analyze that as well:

Example sum.js:

/**
 * Returns the sum of two operands
 * @param  {Number} a The first operand
 * @param  {Number} b The second operand
 * @return {Number}   The sum of both operands
 */
function sum (a, b) {
  return a + b
}

module.exports = sum

screen shot 2016-07-02 at 3 01 30 pm

You'll want to make sure you have the following in your user preferences:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants