Open Orbyt opened 8 years ago
tern_for_sublime
through Package Control.tern_for_sublime
folder in your Packages
Directory.npm install
And you should be good to go.
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
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:
It can also infer types:
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
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": "."}
]
}
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?