A barebones boilerplate for Haxe in VS Code. Install the Haxe extension to get the most out of this boilerplate.
The sample code included uses new Haxe 4.0.0 language features.
Launch configurations for the following debuggers are included:
- JS (Node)
- Flash
VS Code already has built-in support for debugging with Node. Just make sure to install the Node JS runtime.
You need to have the Flash Debugger extension installed.
It is configured to use utest. Debugging support for unit tests is also available.
Since Haxe 4.0.0-preview.2,
haxe.unit
has been moved tohx3compat
. Instead of usinghx3compat
, I have opted to useutest
. Moving to a different unit testing library only means updating dependencies (-lib
) in the rootbuild.hxml
andconfig/build-tests.hxml
files.
The build.hxml
at the root is just for the Haxe completion server utilized by the Haxe extension, hence, it only contains -lib
commands. This file informs VS Code auto-completion which libraries are in use.
The config
folder contains the main configuration for the application and unit test builds. It primarily contains the class path (-cp
) and main class (-main
) commands since these commands are shared among the different build targets. Specific dependencies for each definition (-lib
) that will be used to build the application and unit tests should also be placed here.
The target specific compilation switches are declared in tasks.json
.
The conventions used in this boilerplate are specific to my own tastes and are clearly a bit far from the norm. If you have installed the Haxe extension, you can easily configure this by modifying the hxformat.json
file at the root.
You can find instructions on how to configure formatting here. Further details about the full schema of hxformat.json
can be found here.
You also have to modify
.editorconfig
if you want to change the use of space to tabs and also to change the indent size.
I created this boilerplate as a way to quickly setup a Haxe coding environment.
Much of the tutorials/instructions on setting up one's development environment focus on Haxe's specific use cases. There are instructions to get up and running quickly but usually lack instructions on how to setup debugging, especially on VS Code.
This boilerplate's setup is focused on getting an environment up that focuses more on the language. This is mainly useful for beginners or to just quickly try out some idea or piece of code.