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

Using existing zig install does not work

Open zbynekwinkler opened this issue 2 years ago • 6 comments

I am using VSCodium on Windows 11. I've installed zig and now this extension v0.5.1. I get a pop up asking to either install zig, set path, find zig in path or cancel. When set the path to existing zig.exe, it does not work. In Runtime Status of the extension I see spawnSync /C:/Users/Zbynek/bin/zig.exe ENOENT

image

It seems the forward slash at the beginning might be the problem but I am not sure how to verify. However, the path never gets set to the property zig.path. When I do set the property by hand to the proper path, I get the same exception. After install, the property gets set to

"zig.path": "c:\\Users\\Zbynek\\AppData\\Roaming\\VSCodium\\User\\globalStorage\\ziglang.vscode-zig\\zig_install\\zig.exe",

When set to

"zig.path": "c:\\Users\\Zbynek\\bin\\zig.exe",

I get the exception.

zbynekwinkler avatar Oct 25 '23 07:10 zbynekwinkler

Just to confirm, the path on your computer actually ends with \\bin\\zig.exe, and not something like \\bin\\zig-windows-<version>\\zig.exe?

This default unzipping behavior of windows caught myself off guard after using linux for an extended period of time.

metroidchild avatar Oct 26 '23 12:10 metroidchild

It does. It is installed with zigup. It is some kind of forwarding exe to the real thing that lives in the same directory in subdirectory zig\\0.11.0\\files\\zig.exe. I can use it from cmd prompt:

C:\Users\Zbynek\bin>where zig
C:\Users\Zbynek\bin\zig.exe

C:\Users\Zbynek\bin>zig version
0.11.0

But that has given me an idea - when I set the path to c:\Users\Zbynek\bin\zig\0.11.0\files\zig.exe which is the real executable to which the zigup-provided zig.exe forwards, it works. When I replace the forwarding executable with a soft link, it also works ok.

C:\Users\Zbynek\bin>dir zig.exe
 Volume in drive C is Windows
 Volume Serial Number is 4624-DE45

 Directory of C:\Users\Zbynek\bin

28/10/2023  17:31    <SYMLINK>      zig.exe [c:\Users\Zbynek\bin\zig\0.11.0\files\zig.exe]
...

So the issue actually seems to be that the extension does not like what zigup is doing wrt the forwarding exe.

zbynekwinkler avatar Oct 28 '23 15:10 zbynekwinkler

Note that zigup is redundant with this extension installed.

Vexu avatar Oct 28 '23 15:10 Vexu

I installed the Zig extension after having downloaded Zig on my D: drive. I didn't add it to my PATH, but I manually set the path to zig.exe in extension settings. Despite that I still get the popup asking me to set Zig's path on each startup: image

Though I can cancel and stuff works (ZLS works and can compile with Build Workspace)

Zylann avatar Mar 28 '24 21:03 Zylann

Is you vscode config file read only? The extension should be setting zig.initialSetupDone: true after you have selected one of those options once (other than cancel).

Vexu avatar Mar 28 '24 22:03 Vexu

It is not read-only. Also I see zig.initialSetupDone is false. I never actually picked any of the options on that dialog, I setup Zig's path after installing the extension by going into the settings myself.

When the popup showed up later, this time I selected "Specify path" and selected again where my zig executable is. But even after I do that, I notice "initial setup" is still false: image And the popup still shows up.

Zylann avatar Mar 28 '24 22:03 Zylann