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

Does not find zig and zls in path

Open johan0A opened this issue 7 months ago • 8 comments

Image my system:

OS: Arch Linux x86_64
Host: B450M DS3H
Kernel: Linux 6.14.4-arch1-1
Uptime: 1 hour, 21 mins
Packages: 847 (pacman)
Shell: bash 5.2.37
Display (LC27G7xT): 2560x1440 @ 144 Hz (as 2229x1253) in 27" [External]
DE: KDE Plasma 6.3.4
WM: KWin (Wayland)
WM Theme: Breeze
Theme: Breeze (Dark) [Qt], Breeze-Dark [GTK2], Breeze [GTK3]
Icons: breeze-dark [Qt], breeze-dark [GTK2/3/4]
Font: Noto Sans (10pt) [Qt], Noto Sans (10pt) [GTK2/3/4]
Cursor: breeze (24px)
Terminal: konsole 25.4.0
CPU: AMD Ryzen 7 3700X (16) @ 3.60 GHz
GPU: NVIDIA GeForce RTX 3070 [Discrete]
Memory: 8.10 GiB / 15.54 GiB (52%)
Swap: 0 B / 4.00 GiB (0%)
Disk (/): 18.16 GiB / 456.39 GiB (4%) - ext4
Disk (/run/media/johan/467EE8697EE8536B): 496.66 GiB / 931.51 GiB (53%) - ntfs3
Local IP (enp5s0): 192.168.1.95/24
Locale: **en_US.UTF-8**

johan0A avatar Apr 30 '25 00:04 johan0A

I realized this is probably an issue with my particular setup ill do a little more research before reopening this

johan0A avatar Apr 30 '25 00:04 johan0A

Did you manage to fix this? It suddenly appeared for me as well

shilangyu avatar May 31 '25 14:05 shilangyu

@shilangyu no but I was back on windows shortly after so I didn't tinker a lot to get it working. As a workaround you can use directly the path to the zig and zls executables. I'll reopen the issue.

johan0A avatar May 31 '25 15:05 johan0A

There isn't enough information in this issue to identify the cause. I have some questions that could be helpful to figure out what is going on:

  • What version of the vscode-zig extension has been installed?
  • How was Zig and ZLS installed?
  • If Zig was installed manually, was it added to $PATH? If so, how was it added?
  • What value is $PATH in the integrated VS Code terminal?
  • What value does which zig and which zls output in the integrated VS Code terminal?
  • What Zig or ZLS related vscode settings have been set? Specifically the zig.path and zig.zls.path options.

Techatrix avatar Jun 07 '25 20:06 Techatrix

good point

What version of the vscode-zig extension has been installed?

0.6.10

How was Zig and ZLS installed?

I use zvm: https://github.com/tristanisham/zvm It creates a symlink to the zig and zls installation directory, and you can add it to $PATH Installing zig manually does not help.

If Zig was installed manually, was it added to $PATH? If so, how was it added?

By modifying .bashrc

What value is $PATH in the integrated VS Code terminal?

(after manual installation) /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/johan/.local/bin/zig:/home/johan/.local/bin/zls

What value does which zig and which zls output in the integrated VS Code

$ which zig
/home/johan/.local/bin/zig/zig
$ which zls
/home/johan/.local/bin/zls/zls

What Zig or ZLS related vscode settings have been set? Specifically the zig.path and zig.zls.path options.

"zig.path": "zig",
"zig.zls.path": "zls",

johan0A avatar Jun 07 '25 23:06 johan0A

By modifying .bashrc

I think I've run into this, if so it should work as expected when launching vscode from the terminal (which of course shouldn't be required).

Vexu avatar Jun 07 '25 23:06 Vexu

if so it should work as expected when launching vscode from the terminal

yep it does for me as well

johan0A avatar Jun 07 '25 23:06 johan0A

~I believe prioritizing user settings in the implementation could help address this issue, though I understand there may be other aspects to consider.~

https://github.com/ziglang/vscode-zig/pull/440

~I've created a PR that demonstrates this approach. Please feel free to review it. If it doesn't align with the project's direction, users experiencing this issue can still benefit by building the plugin locally with these changes.~

~I think this issue relates to the automatic path resolution feature. While this feature wasn't needed in my use case, I~ ~recognize it likely provides value for many users.Perhaps there's an opportunity to make it less intrusive while maintaining~ ~its helpful functionality.~

I was mistaken. https://github.com/ziglang/vscode-zig/pull/440#issuecomment-3069977420

hashiiiii avatar Jul 12 '25 17:07 hashiiiii