vscode-zig icon indicating copy to clipboard operation
vscode-zig copied to clipboard

Problem has incorrect path if zig build outputs ./a/relative/path

Open marnix opened this issue 5 years ago • 1 comments

I see the following occurring:

  • This extension runs the zig build command in VSCode's current directory, using all absolute names (the binary by doing its own PATH lookup presumably, the --build-file because 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 build outputs 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 when zig build is 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 build to be run with the workspace directory as the current directory, so that the workspace's zig-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.

marnix avatar Dec 05 '20 22:12 marnix

The problem seems to be that vscode.Uri.file("./a/b") returns an object with path: "/./a/b"?

marnix avatar Dec 15 '20 20:12 marnix