Selecting a shell script (on windows, so a .cmd or .bat file) for the Zig path after choosing “Manually Specify Path” from the status bar button in VS Code sends an error notification Failed to run 'C:\path\to\zig.cmd version'!
It seems that this might happen because the getVersion check in zigUtil.ts calls child_process.execFileSync
, whereas running a shell script requires calling child_process.execSync
.
I presume this is also why we have to specify "type": "process" | "shell"
in tasks.json, though I don’t know node that well. Just trying to do a little due diligence.
Also, it’s not clear to me from poking at it: is there an association between what I put for zig.path
in settings.json and the zig version selected from the status bar button?
I did manage to get tests to run once, but now I’m in a state where it can’t find any tests, and the “Zig tests” profile is not selectable from the dropdown in the vscode tests sidebar.
I do have a test task set up in tasks.json which builds and runs and passes, so it should run. I had a path in workspace settings.json with a vscode variable in the string (${workspaceFolder}/tools/zig.cmd
), and that seems to also cause problems, even if I change the path to point to the actual zig.exe rather than the shell script.
The reason I had this is because I have a setup script for collaborators to run which just downloads the right version of zig to a .gitignored folder. It’s also been helpful for me to quickly swap to different versions to see if I need to change any code to keep current with nightly, or to build with a locally build zig for the (now-rare ) occasional compiler crash or miscompile. I realize the extension will now manage versions for me, but I’m not sure I want to abandon my scripts and tie the workflow to vscode.
Anyone here run into similar issues and have Pro Tips to offer?
My ideal is that I can still use my zig.cmd script and tell vscode-zig to run that whenever it wants to run zig. This has been working fine for zig build check
steps. Autocomplete and zig fmt
on save all work fine with the shell script.
Posting here rather than the issue tracker since I think I need a little more info on how it’s all intended to work with the new version-managing hotness.