Sublime Forum

I can't get tern-phaser working fully in Sublime Text

#1

Hi,

I’m quite new to Sublime Text, and to modern Javascript development (used in the past but everything seems to have changed a lot!).

I want to use the phaser.io game engine and achieve code assist/completion via Tern and the tern-phaser plugin, but the documentation is quite slim, and I think it assumes the user has great experience with node package manager and Sublime Text.

I think Tern is installed correctly - it’s clearer to see this. I had to install Node.js first, and although Tern seems to hiccup in Sublime Text when installed via Package Control, you can repair this (or so I read) by navigating to the install folder in the Sublime Text ‘Packages’ folder and run ‘npm install’ while there.

The extension for Tern, for phaser, is here:

The instructions mention ‘INSTALL.md’, which I’m referring to below:

It explains: “If you are using Marijn Haverbeke’s own tern_for_sublime, then you can run npm install tern-phaser in the tern_for_sublime directory, where you ran npm install.”

Since I’ve installed tern_for_sublime initially via Package Control (even though I subsequently went into the folder and unpackaged to fix a broken installation, in accordance with a fix I found online), I assume I’m in the right place: “in the tern_for_sublime directory, where you ran npm install”.

Prior to posting here, I’d tried tern_for_sublime and TernJS (the only alternative I can see) several times, and followed steps from various guides online to get Phaser’s code completion working via Tern too. It never seems to be right - I get messy code completion drop-downs that even contain integer values that I assume it’s grabbing from the open document. The code completion box never shows the tidier method/property lists I’ve seen in example screenshots - this is what I’m looking to get.

So before I say “nothing’s working”, I feel like I need to make sure I’ve seen tern_for_sublime with tern-phaser, working. I just feel like I can’t tell whether it’s worked, though, or what I’m doing wrong.

I navigate to C:\Users[myUser]\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime in Command Prompt, then type ‘npm install tern-phaser’, as explained by the install instructions.

What I don’t understand, though, is that I thought NPM works by installing packages from a remote location, based on the name you specify, and installs them into a central location for management by NPM. I guess I’m not completely right on this, since one of the above steps involved me navigating to the tern_for_sublime folder to finish the broken install by manually extracting a package.

Anyway, when I run “npm install tern-phaser” inside tern_for_sublime folder, the command prompt shows output that looks like success, but I didn’t see anything new added to the tern_for_sublime folder, and I’m still none the wiser.

Any help is appreciated.

Thanks

0 Likes