ternjs / tern_for_sublime

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

Sublime text functionality not the same as tern.js website demo #91

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi there, I might be asking something stupid but I'm a newbie so bear with me :)

In the tern.js website demo (http://ternjs.net/doc/demo/), if I type, for instance: var x = pr

and then press CTRL + SPACE, the autocompletion dialog pops up and I can get: var x = prompt

then if I add a parenthesis, as in: var x = prompt(

I can get the documentation for that function:

prompt(message: string, value: string) -> string

So I end up with something like this: var x = prompt("Foo");

Then I can type: x.

Press CTRL + SPACE and I will get all the string functions:

charAt, indexOf...


In ST3 I can't get any of this functionality. If I type: var x = pr And press CTRL + SPACE it won't show the prompt() function.

Also, if I have: var x = prompt("Foo"); And then type: x. It won't recognize var x as a string so it won't show the string functions autocompletion.

Is this the expected behaviour or is my instalation not working properly?

marijnh commented 8 years ago

This sounds a lot like you're forgetting to include the "browser" type definitions, and thus Tern doesn't know about prompt.

Add a .tern-project file containing something like {"libs": ["browser"]} to your project directory.