Jump to content

Phaser + Sublime Text (Snippets / Completions)


Travis
 Share

Recommended Posts

Since the devs recommend Sublime Text for Phaser, has anyone made any snippets / completions for the library yet? Are there any plans to?

 

EDIT: Until then, the best option I've found is just to open the un-minified version of phaser.js in your project and use https://sublime.wbond.net/packages/All%20Autocomplete.

Link to comment
Share on other sites

Genius idea! Thanks for posting this!

 

Ive been thinking about code completion for this library for a while, I tried out reverting back to Sublime Text 2 for CodeIntel, I was starting to install Visual Studio Express, and I even debated buying WebStorm!

 

I knew this plugin existed, but the idea of just keeping the engine open and using this never even crossed my mind. A thousand times thank you, you certainly saved me some headaches and research tonight. (Seriously, I started install Visual Studio and felt like I was suffocating).

 

What do you plan to use for code completion once someone makes a snippets file or whatever? (Are these usually JSON or a doc file or something?)

Link to comment
Share on other sites

Most sublime text extensions are their own file type, but are very simple in practice. I think almost all sublime files are based on xml. You can see an example of this here: http://sublimetext.info/docs/en/extensibility/snippets.html

 

How was CodeIntel? I have the sublime beta so I couldn't download it. I'm interested how effective it is in practice.

 

As for code completion, I'll just use the plugin in tandem with All Autocomplete, or just one if they are conflicting. I actually don't mind writing the functions out, I just like having code completion so that I have an easy way of seeing the function names that I need. For example in easelJS I had the hardest time remembering getNumChildren... always had to look it up until I started using autocomplete.

Link to comment
Share on other sites

I know what you mean, I like the completion for the same reason. 

 

I didnt try CodeIntel with Phaser, I was waiting for the 1.0 release. I did try it with Crafty engine, and it was good, except that it didnt autodetect everything. It would prompt me with a list of items, but when I dug in to the engine I saw other methods that would be valid for a given instance, but they weren't in the autocomplete list. Part of my plan tonight was to figure out what was happening and why. It was also my first try at Sublime Text 2, and I must say Im quite happy that there is now a solution for 3. 

 

So if someone made a snippets file for the Phaser engine it could be used like a plugin? Are there really any other options then what you've outlined here if someone doesn't put together something like that?

Link to comment
Share on other sites

If anyone has some good guides on how to create auto-complete files for Sublime then it's something we'd be happy to do. I assume it's not that intelligent, i.e. it won't recognise that a variable is a Sprite for example, in the way that something like WebStorm can. But at least it could provide functions and parameters.

Link to comment
Share on other sites

Spending the past few minutes looking more into it, it looks quite... challenging. Check out the git repo for Sublime Code Intel - perhaps this would give you an idea of how much work it would take. https://github.com/SublimeCodeIntel/SublimeCodeIntel

 

Since I actually haven't tried out Code Intel, I'm not actually sure if it will satisfy my needs. I did enjoy the Webstorm code completion, so hopefully it's like that. Once they upgrade to ST3 then I'll give it a go.

Link to comment
Share on other sites

Through this thread: http://www.html5gamedevs.com/topic/1343-intellisense-with-vs2012/ I picked up on a package called Tern that does autocomplete.

 

It's much better than All Autocomplete, imo. Installation instructions here: https://github.com/marijnh/tern_for_sublime. Works great with Sublime Text 3. 

 

I still want to try out Code Intel when it gets done being ported to ST3.

 

Apologies for reviving a dead thread : )

Link to comment
Share on other sites

Oh wow, thanks for the heads up. this is MUCH better than tern. Although it has trouble reading from the Phaser library, even if I put it in the project base directory. It's nice for referencing functions you've already created/used in your code. If it could read from Phaser.js that would make it perfect.

Link to comment
Share on other sites

  • 8 months later...

Hello there,

I've just installed CodeIntel on my Sublime 3.

Can someone explain me step by step how to make Sublime 3 hints Phaser mathods?

I've seen that Phaser comes with a file named pahers.map that seems to contain the decription of each methods.

How can I add this to codeIntel?

Thanks in advance

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 months later...

I wish it was that simple. If anyone knows how to actually create a code-insight / completion plugin for Sublime, then we'll do it! Because we all use Sublime every day for all our development, so it would be a great help to us too. I've just never seen anything that can actually do it though :(

I have actually found someone doing this already but so far he has only autocomplete for a few stuff(He has a checklist). You can check this out and maybe help him. I would do help too if I am not a programming newbie:

 

https://github.com/Arlefreak/Phaser-Snippets

Link to comment
Share on other sites

  • 10 months later...
  • 3 weeks later...

hey, guys. I know how to create a  completion plugin for sublime, it's simple. Just make a json file with "trigger" and "content", then put the file in the right folder and it will work.

actually I am working on that and I hope it could be helpful.

 

see it right here: https://github.com/longjian/Phaser-completions

 

I am just a new guy here and I hope anyone interested could help me with the completions project. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...