Simple template of empty project for VSCode


#1

Hello! Here is my template for VSCode of empty openfl application with debugging for Html5 (Chrome) & Hxcpp https://github.com/r3d9u11/vscode-templates/tree/master/haxe/openfl_application, may be it will be useful for someone.


#2

Cool idea for vscode! Thanks for template for VS Code. Yeah i don’t need to install FlashDevelop.


#3

Instead of making a tasks.json file, you should probably use the Lime extension. (I assume that supports debugging too, but I haven’t checked.)


#4

I’m using VS code for Haxe for a while now and i’m pretty happy with it. Also I’m using VS code as my default code-editor and I can highly recommend it. When editing a Haxe *.hx file VS code will probably recommend to install these modules and I highly suggest you do that.

These days there all bundled in:

For VS code you only need the .vscode directory from the above template. You can put it in any generated or existing project folder.

@r3d9u11 Perhaps you can be as kind to put, Android, IOS and Mac task to the template? Also you are using: openfl build <...> which will only build the project. Why not use: openfl test <...> which will not only build the project but also executes it. For the most part during development this is what you want! VS code will output stdout - and with that all traces - to a log window! Or maybe provide both.

		{
			"taskName": "Test Android",
			"command": "openfl",
			"args": [ "test", "android", "-release" ]
		},
		{
			"taskName": "Test IOS",
			"command": "openfl",
			"args": [ "test", "ios", "-release" ]
		},
		{
			"taskName": "Test Mac",
			"command": "openfl",
			"args": [ "test", "mac", "-release" ]
		},
		{
			"taskName": "Build Android",
			"command": "openfl",
			"args": [ "build", "android", "-release" ]
		},
		{
			"taskName": "Build IOS",
			"command": "openfl",
			"args": [ "build", "ios", "-release" ]
		},
		{
			"taskName": "Build Mac",
			"command": "openfl",
			"args": [ "build", "mac", "-release" ]
		},

Also a keybinding in keybindings.json will speed up the development process. That way you can execute a task with a hotkey. I don’t belief you can do that in the .vscode directory, but you can do it in your user settings from the menu: File -> Preferences -> Keyboard Shortcuts and then click the link: keybindings.json so you can edit the json file manually. You can for example make something like this:

[
    { "key": "ctrl+alt+b", "command": "workbench.action.tasks.runTask",
        "args": "Build C++ release" }
]

This will bind CTRL-ALT-B to the taskName: “Build C++ release” from the template. I personally always have a task named TEST in my task.json and have binded CTRL+ALT+B to it. That’s so that when I have VS code open and press those keys, a test build is made regardless on which project, platform or computer-language I’m on.

VS code has a lot of cool modules, for example: hexdump by slevesque is handy if you work with a lot of binary files. You can also search for new modules in VS code itself… Speaking of which, shouldn’t somebody make a haxe/openfl scene viewer/editor for VS code? That way we can just view/edit the app from with VS code, together wit a decent debugger seems like a lot of fun! :smiley: I’m of course amazingly incredibly busy and have absolutely no time to make it, but one of you guys can… right!

So Happy Coding \m/ :stuck_out_tongue:


#5

The Lime extension does all of that automatically. You can use dropdown menus to choose a target and build type, and you can set one hotkey for lime build and another for lime test.


#6

Oke great! The Lime extension seems to give a more out-of-the-box experience then the others. I most definitely will check that out. The extra tasks where to complete the template! That can still be handy if you for what ever reason are not using the lime extension.


#7

If you have ideas to improve/hack on the Lime extension, please feel free to tinker :wink: