I've spent the las few weeks on and off playing with zig and I quite like various aspects of it. But I'm having real trouble how to correctly set up the environment and the documentation doesn't seem to cover that:
- we have build.zig.zon which apparently lets you import dependencies, great. And from what I understood, you need to use the dependency api and then add it as imports to the root module? This is not what the docu and various posts say, that's reverse-engineered from, I believe, the zig compiler. So it may be wrong
- how are you supposed to run tests? when I integrate things in build.zig, it looks like they get somewhat picked up, but
zig build testexecutes everything and caches the output so I can't even look at the errors / test results normally. On the other handzig testseems to ignore build.zig and then fails to build a file. - how do you debug a file with tests? both the official zig extension and zig language extras run zig test under the hood, so they won't compile, because they ignored build.zig. (I managed to run a single unit test with debugger no problem as long as it's a toy example without external dependencies).
- how to have the lsp eat build.zig? The same problem about missing libraries also happens in the LSP insofar as it gives compile errors for missing modules even though the same file compiles under
zig build
It is so hard to set up, I'm almost certain I must be doing something deeply flawed, but I'm just not seeing any posts or docu explaining how to set it up.
Writing anything bigger than a toy example, I'd expect one to need a proper per-file debugging experience for tests, debugging the app with a main entry point and being able to depend on modules that are not part of the project but rather imported through build.zig.zon