Hey OpenFL community,
This afternoon, I decided that I wanted to give OpenFL a try. Kick the tires a bit. I have 15 years of experience in ActionScript and Flash, and I am also well versed in frontend web development using TypeScript/JavaScript.
A long time ago, I gave Haxe and OpenFL a try, but I decided (at the time) that it wasn’t for me. It’s been a few years (or maybe more), and I figured that it might be interesting to see where things stand a few years later. Since I never took a deep dive, I’m basically a complete newbie. As a library/product author myself, I know that it’s very valuable to see the getting started experience from a new user’s perspective. Long after you’ve forgotten the struggles yourself, it can be hard to remember (or guess) what’s hard for someone that’s never used your project.
I am a heavy user of Visual Studio Code. I use it both for TypeScript/React and ActionScript/AIR/Royale/etc. In fact, I’m the guy who created the AS3 & MXML extension for VSCode.
Part 1: Installation and Create Project
To start my journey, I searched for “openfl vscode” on Google. This led me to the Github page for the Lime and OpenFL extension for VSCode. I search for this extension inside VSCode and install it.
At this point, this is the first that I’ve heard of Lime, but since the extension is for both OpenFL and Lime, I guess Lime must be somehow related to OpenFL. I go to the Lime website and click the “Get Started” button. It looks like I need to install Haxe and the Lime command line tool to get started with the VSCode extension. I follow the instructions to do this, and then I create one of the samples and open it in VSCode:
lime create SimpleImage
code SimpleImage
Hmm… it seems that this sample code contains zero references to OpenFL. I guess this means that Lime and OpenFL are not supposed to be used together after all? Something to research later, I guess.
Okay, so I head to the OpenFL website, and I see that OpenFL has its own command line tool too. I install it and create another sample:
openfl create DisplayingABitmap
code DisplayingABitmap
This sample code seems more like what I was expecting!
However, I immediately get an error notification in VSCode:
Unable to build cache - completion features may be slower than expected. Try fixing the error(s) and restarting the language server.
[Retry] [Show Error]
Clicking “Retry” just re-displayed the same error.
Clicking “Show Error” gave me this output:
Haxe language server started
Listening on port 6000
Haxe version does not support JSON-RPC, using legacy --display API.
Building Cache...
Failed - try fixing the error(s) and restarting the language server:
Type not found : ApplicationMain
Type not found : ApplicationMain
Type not found : ApplicationMain
What does this mean? No idea, so I head to Google. I find this thread that says I need to compile one time before everything will work properly in VSCode:
I press Ctrl+Shift+B and it gives me a task: lime build html5, so I run it.
Then, I click “Retry” again on the original error notification.
The error doesn’t get shown again, so that seems to have fixed things! The completion list pops up as I type, tooltips appear on hover, and Ctrl+Click to go to definition works. Looks like I’m on the right track so far.
I’ll share some more experiences below, as I try out other things.
My Feedback/Suggestions
However, I think that it’s really important for the VSCode extension to explain that a project needs to be compiled one time to work properly. Not everyone is going to be patient like me. I’m used to being an early adopter. Many developers will just assume that the VSCode extension is broken.