vscode-zig
vscode-zig copied to clipboard
Problem has incorrect path if zig build outputs ./a/relative/path
I see the following occurring:
- This extension runs the
zig buildcommand in VSCode's current directory, using all absolute names (the binary by doing its own PATH lookup presumably, the--build-filebecause of the VSCode default${workspaceDirectory}/build.zig). - That directory is my home directory normally, when I start VSCode from Ubuntu's starter.
- In that case only, for a reason I don't know,
zig buildoutputs file names in compile errors as./whatever/my/project/dir/somefile.zig, so relative to my home directory. (Otherwise it outputs them as absolute file paths.) So only whenzig buildis started in the home directory, the output looks like this:
./projects/zig-mm/src/verify.zig:110:5: error: enum field not found: 'Constan'
Constan: void,
^
- This extension gets confused by those relative file names: it seems to ignore the leading dot (
.), thinks the problem is in the file/whatever/my/project/dir/somefile.zig(absolute path) which does not exist of course. - Therefore the problems are not shown in the editors, and clicking on them does not work (and gives me a confusion 'Create FIle' option).
When I start VSCode (code) from the command line, from my workspace directory, things work perfectly fine.
So there seem two bugs here:
- The lesser one is that I would prefer
zig buildto be run with the workspace directory as the current directory, so that the workspace'szig-cache/directory is used. - The larger one is that relative paths starting with
.should be correctly resolved.
This is with version 0.2.5, which VSCode says is the latest one currently, and with Zig 0.7.0.
The problem seems to be that vscode.Uri.file("./a/b") returns an object with path: "/./a/b"?