ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

tern_for_sublime doesn't fully work (ecma5, browser, jquery) #54

Closed davidsteinberger closed 9 years ago

davidsteinberger commented 9 years ago

After the install I can't get e.g. browser support to work. These examples do not work:

document.body.
// -> completion (e.g. addEventListener) does not work

$("form").on("click", selector, data, function(e) {
    // -> completion (e.g. event functions) does not work
});
marijnh commented 9 years ago

Have you enabled the browser defs? I.e. something like this in your .tern-project file:

{
  "libs": ["browser"],
}
subhaze commented 9 years ago

On my end I can confirm that document.body. is giving correct completions.

As for the fn signature on("click", selector, data, function(e) does not give completions for e, but on("click", function(e) does.

N4M3Z commented 9 years ago

This might be obvious, but since I was the one having the issue, I might as well make the point: tern autocompletes only on packages installed through npm, hence you won't get autocompletion for document unless you installed npm install browser. I hope this does save somebody's time some day.