Zig Version
0.15.2
ZLS Version
0.15.1
Client / Code Editor / Extensions
vscode Zig extension running in Linux Mint 22.2
Steps to Reproduce and Observed Behavior
- Clone https://github.com/castholm/zig-examples
- Open opengl-hexagon
zig build run
- Close editor
- Open it up some time later
You will possibly get a SDL.h file not found type of error. Removing zig-out, .zig-cache and restarting vscode does not help. Restarting the language server inside vscode with CTRL + SHIFT + P seems to have solved it but it will probably come up again as I've seen similar things before. I am expecting this behavior to be reproducible in any project using @cImport with a similar system.
One hypothesis is that behavior happens when running several zls. In fact I opened a personal project that had the same @cImport right before opening the opengl-hexagon project. The first project did not have this issue. Though I have seen the opposite situation happen as well where opengl-hexagon can open it fine but my own project cannot.
Just to clarify: zig build run always succeeded.
Expected Behavior
As long as the C header file is in the .zig-cache/o/<some_number> zls should always be able to find the file. Clearing caches and
Attach ZLS log output
The log could really do with timestamps because right now I have no clue what happened when. Presumably this error didn't happen on the last log restart but I cannot see a difference.
info ( main ): Starting ZLS 0.15.1 @ '/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zls/x86_64-linux-0.15.1/zls'
info ( main ): Log File: /home/jesper/.cache/zls/zls.log (info)
info (server): Client Info: Visual Studio Code (1.106.2)
info (server): added Workspace Folder: file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon
info (server): Set config option 'enable_build_on_save' to true
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/jesper/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/lib"
info (server): Set config option 'zig_exe_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/zig"
info (server): Set config option 'build_runner_path' to "/home/jesper/.cache/zls/build_runner/cf46548b062a7e79e448e80c05616097/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/jesper/.cache/zls"
info (server): trying to start Build-On-Save for 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon/build.zig'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/build.zig'
info (store ): Loaded build file 'file:///home/jesper/.cache/zig/p/zigglgen-0.4.0-bmyqLV6PLwAt0VCiGVgz6kZ448zaiTix2Z8MXEEuN4Vi/build.zig'
info ( main ): Starting ZLS 0.15.1 @ '/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zls/x86_64-linux-0.15.1/zls'
info ( main ): Log File: /home/jesper/.cache/zls/zls.log (info)
info (server): Client Info: Visual Studio Code (1.106.2)
info (server): added Workspace Folder: file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon
info (server): Set config option 'enable_build_on_save' to true
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/jesper/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/lib"
info (server): Set config option 'zig_exe_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/zig"
info (server): Set config option 'build_runner_path' to "/home/jesper/.cache/zls/build_runner/cf46548b062a7e79e448e80c05616097/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/jesper/.cache/zls"
info (server): trying to start Build-On-Save for 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon/build.zig'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/build.zig'
info ( main ): Starting ZLS 0.15.1 @ '/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zls/x86_64-linux-0.15.1/zls'
info ( main ): Log File: /home/jesper/.cache/zls/zls.log (info)
info (server): Client Info: Visual Studio Code (1.106.2)
info (server): added Workspace Folder: file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon
info (server): Set config option 'enable_build_on_save' to true
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/jesper/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/lib"
info (server): Set config option 'zig_exe_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/zig"
info (server): Set config option 'build_runner_path' to "/home/jesper/.cache/zls/build_runner/cf46548b062a7e79e448e80c05616097/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/jesper/.cache/zls"
info (server): trying to start Build-On-Save for 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon/build.zig'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/build.zig'
info ( main ): Starting ZLS 0.15.1 @ '/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zls/x86_64-linux-0.15.1/zls'
info ( main ): Log File: /home/jesper/.cache/zls/zls.log (info)
info (server): Client Info: Visual Studio Code (1.106.2)
info (server): added Workspace Folder: file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon
info (server): Set config option 'enable_build_on_save' to true
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/jesper/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/lib"
info (server): Set config option 'zig_exe_path' to "/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zig/x86_64-linux-0.15.2/zig"
info (server): Set config option 'build_runner_path' to "/home/jesper/.cache/zls/build_runner/cf46548b062a7e79e448e80c05616097/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/jesper/.cache/zls"
info (server): trying to start Build-On-Save for 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/zig-examples/opengl-hexagon/build.zig'
info (store ): Loaded build file 'file:///home/jesper/Documents/ZigRepos/build.zig'
info (store ): Loaded build file 'file:///home/jesper/.cache/zig/p/zigglgen-0.4.0-bmyqLV6PLwAt0VCiGVgz6kZ448zaiTix2Z8MXEEuN4Vi/build.zig'
info ( main ): Starting ZLS 0.15.1 @ '/home/jesper/.config/Code/User/globalStorage/ziglang.vscode-zig/zls/x86_64-linux-0.15.1/zls'
info ( main ): Log File: /home/jesper/.cache/zls/zls.log (info)
Zig Version
0.15.2
ZLS Version
0.15.1
Client / Code Editor / Extensions
vscode Zig extension running in Linux Mint 22.2
Steps to Reproduce and Observed Behavior
zig build runYou will possibly get a SDL.h file not found type of error. Removing zig-out, .zig-cache and restarting vscode does not help. Restarting the language server inside vscode with CTRL + SHIFT + P seems to have solved it but it will probably come up again as I've seen similar things before. I am expecting this behavior to be reproducible in any project using
@cImportwith a similar system.One hypothesis is that behavior happens when running several zls. In fact I opened a personal project that had the same
@cImportright before opening the opengl-hexagon project. The first project did not have this issue. Though I have seen the opposite situation happen as well where opengl-hexagon can open it fine but my own project cannot.Just to clarify:
zig build runalways succeeded.Expected Behavior
As long as the C header file is in the .zig-cache/o/<some_number> zls should always be able to find the file. Clearing caches and
Attach ZLS log output
The log could really do with timestamps because right now I have no clue what happened when. Presumably this error didn't happen on the last log restart but I cannot see a difference.