Kode / khamake

Kha's build tool.
http://kha.tech
15 stars 43 forks source link

khafile.js -> await project.addProject("xyz") breaks code-completion (haxe doesn't build cache anymore) #244

Closed Lykdraft closed 3 years ago

Lykdraft commented 3 years ago

First of all, I am not sure if this is a kha-make, a vs-kha issue or what. If this is the wrong place, please point me in the right direction.

So here's the problem: I lose code completion in VS Code/Kode when a subproject is present. Because Kha adds an await in front of project.addProject(“xyz”) in khafile.js and this somehow stalls the haxe language server (won't proceed to build cache). I am not sure why this “await” breaks code-completion, but somehow it does.

So I drilled the problem down to this line in khafile.js (in this special case it's Koui in an Armory3D project): await project.addProject("Subprojects/Koui");

When I remove the "await", Haxe will build cache and parse classpath again, so code completion works again. However, then I obviously get type not found errors for the (in this case Koui) types.

Also on rebuild, the “await” gets added again and code completion is lost again.

This is recreatable 100% any time in any project where a subproject folder is present. So now I know what the problem is, I just can’t think of any solution to this…

Any help here?

Thanks, tL.

RobDangerous commented 3 years ago

When you remove the await, the subproject is simply not added. This is not about the await, something in the generated hxml must throw vshaxe off. Will have a look. But a rebuild doesn't do anything to your own khafiles in Kha, that has to be something else.

Lykdraft commented 3 years ago

Thanks for looking into that. I should have mentioned that the rebuild is done via F5 in Blender (Armory3D) so the khafile.js gets auto-created / overwritten every time the project is run.

Lykdraft commented 3 years ago

Robert, I think I solved this. It seems like I need to compile in VS Code to the target first and not in A3D/Blender. All subsequent plays from A3D will then not break code completion.

I tested this for now with two projects, so this should be it as I tried 1000 times to get cc back on both of them and never succeeded.
Now it worked like 10 times in a row. So, yeah...

Sorry for wasting your time. Best, tL.

RobDangerous commented 3 years ago

No worries - just keep in mind that figuring out whether it's a Kha problem or an Armory3D problem should always be the first step, ideally by creating a minimal Kha project and trying to reproduce the problem there.

Lykdraft commented 3 years ago

Understood. Thanks again!