When I use an *.hxml file that contains more than one target, like so:
-cp src
-D analyzer-optimize
-main Main
-dce full
-cmd start "" "C:\Program Files\Mozilla Firefox\firefox.exe" "http://localhost/index.php"
--each
-js bin/Commerce.js
--next
-lib easylog
-php bin
the vshaxe extension doesn’t seem to acknowledge the second target at all.
In this case, the php target doesn’t get compiled, and errors in my php-targeted haxe source code don’t get picked up; i.e., the -cmd gets executed anyway, as if all compilations were successful.
Also, the php-targeted source code is dimmed.
If I swap the js and php targets around, then only the php target gets compiled, and the js target is completely ignored, and dimmed.
Is this as expected?
The HaxeDevelop IDE does this correctly, i.e. it will compile the targets, and will un-dim them.
But I don’t want to use HaxeDevelop, I want to use vshaxe on VS Code…
Yes, code completion doesn’t support --next. It should work fine for compilation though.
Pretty sure HaxeDevelop doesn’t “dim” anything in the first place? Compiler completion still won’t work in those inactive blocks, HaxeDevelop just doesn’t tell you.
Sometimes it does, and sometimes it doesn’t; it’s entirely unpredictable.
Sometimes with errors in the source code, -cmd still runs; sometimes with no errors in the source code, -cmd doesn’t run…
What I need is some way to check where all this flakiness is coming from…
It’s extremely frustrating, and I am not getting any work done whatsoever.
Yeah, it seems you’re right, I remembered that incorrectly.
HaxeDevelop does however compile both targets, something VS Code / vshaxe doesn’t always do (or maybe it does but then refuses to execute -cmd), see above.
For completion, you really need one .hxml file per target or else the compiler gets really confused. You can still have a separate .hxml for actually building everything.
As @Simn stated using separate hxmls will be easier, as long as you don’t do it too often you can switch the hxml used in the status bar and it’s not too much of an issue.
But if you need to switch between the js and php part very quickly there’s no good solution.
Your hxml as an issue, the --cmd is run for both the js and php compilation, which is probably not what you want, the webpage might be loaded before the php finished compiling.
I suggest moving this as the last line of your hxml.
Yes, I think getting rid of my all-encompassing “all.hxml” in favour of just having the js.hxml and php.hxml will probably be the road to less frustration.
I will adjust my workflow.
I’ll adapt
I’m writing a web framework where there will be messages going back and forth between client and server, so there is a lot of switching between php and js, but I’ll manage
Ah, I didn’t realise the order of things contained within separate --each and --next sections matters.
But if I stick with just the js.hxml and php.hxml then it won’t matter
By the way, does haxe have a “live/hot reload” mode, where haxe is basically always running and it can e.g. automatically refresh the browser, like Svelte has with “npm run dev”?