cdelstad

Visual Studio Code - Intellisense for Phaser.js?

6 posts in this topic

Does anyone know if there has been an Intellisense implementation I can use with Visual Studio Code for Phaser.js (vanilla JavaScript)?  I know there are TypeScript definition files maintained, though I do not really want to use TypeScript.

I think it would be considered a Language Extension - using the VSCode vernacular.

Anyone know what it would take to create a VSCode extension for Phaser?

@Arian FornarisYou created a plugin for Sublime, would you have any input on this?

Thanks in advance,

-Chad

Share this post


Link to post
Share on other sites

Hi,

I did a test some days before and it just worked :)

 

Just follow these steps:

1- Open a folder in VSCode

2- Create a `jsconfig.json` file at the root of that folder. That file indicates to VSCode that it is a JavaScript project. Just put inside that file this content:

{
}

3- Create a `defs` folder and copy there the Phaser typescript definitions. I just named it `defs` but you can use your own name.

4- Create a new `game.js` file and write some code there, it should auto-complete the Phaser API.

PhaserAutoCompleteVSCode.png

 

I think VSCode uses the TypeScript tooling also to develop JavaScript, but with a type inference engine called Salsa.

If you have any issue tell me.

 

cdelstad likes this

Share this post


Link to post
Share on other sites

It is not working. I am using the 2.6.2 versions of phaser.js and *d.ts files. The latest version of VSCode 1.8.1. Also included are the extensions i have installed.

I don't need to tell it to look for the defs folder anywhere do I? Will VSCode find the ts files?

 

phaser_ts_issue1.png

phaser_ts_issue2.png

Share this post


Link to post
Share on other sites

OK, I got it to work. I had to move some folders around. I moved my lib folder under the js folder to be at the same level as the defs folder. So all of my JS files were under the js folder structure.

Thank you! Works slick.

phaser_issue3.png

Share this post


Link to post
Share on other sites

Great it is working!

Look that probably you would like to exclude the lib content from the jsconfig.json project. The Phaser completions are computed from the d.ts definitions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.