Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build on save diagnostics broken when importing non-existent file #2196

Open
leecannon opened this issue Feb 17, 2025 · 1 comment
Open

build on save diagnostics broken when importing non-existent file #2196

leecannon opened this issue Feb 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@leecannon
Copy link
Member

leecannon commented Feb 17, 2025

Zig Version

0.14.0-dev.3239+d7b93c787

ZLS Version

0.14.0-dev.390+188a4c0

Client / Code Editor / Extensions

vscode

Steps to Reproduce and Observed Behavior

pub fn main() !void {
    const a: bool = 2;
    _ = a;
}

const t = @import("doesntexist.zig");

No diagnostic is shown for either invalid assignment to a or import of non-existent file.

If the const t = @import("doesntexist.zig"); is commented out then invalid assignment to a diagnostic is shown.

Expected Behavior

Diagnostics are shown including one about the file not existing.

Relevant log output

[Info  - 20:12:55] Starting ZLS      0.14.0-dev.390+188a4c0 @ '/home/lee/bin/zls'
[Info  - 20:12:55] Log File:         /home/lee/.cache/zls/zls.log (info)
[Info  - 20:12:55] Client Info:      Visual Studio Code-1.97.2
[Info  - 20:12:55] Autofix Mode:     source.fixall
Offset Encoding:  utf-16
[Info  - 20:12:55] added Workspace Folder: file:///home/lee/src/fresh
[Info  - 20:12:55] Set config option 'builtin_path' to "/home/lee/.cache/zls/builtin.zig"
[Info  - 20:12:55] Set config option 'zig_lib_path' to "/home/lee/zig/0.14.0-dev.3239+d7b93c787/files/lib"
[Info  - 20:12:55] Set config option 'zig_exe_path' to "/home/lee/bin/zig"
[Info  - 20:12:55] Set config option 'build_runner_path' to "/home/lee/.cache/zls/build_runner/9e5b9ae17ea1542863390dfab3c8a26c/build_runner.zig"
[Info  - 20:12:55] Set config option 'global_cache_path' to "/home/lee/.cache/zls"
Took 9ms to process request-0-initialize on Thread 55852
Dynamically registering method 'workspace/didChangeConfiguration'
Took 0ms to process request-17-shutdown on Thread 55574
Took 0ms to process notification-initialized on Thread 55852
[Info  - 20:12:55] Loaded build file 'file:///home/lee/src/fresh/build.zig'
Opened document 'file:///home/lee/src/fresh/src/main.zig'
Took 0ms to process notification-textDocument/didOpen on Thread 55852
Opened document 'file:///home/lee/src/fresh/build.zig' (build file)
Took 0ms to process notification-textDocument/didOpen on Thread 55852
Took 0ms to process response-"register-workspace/didChangeConfiguration" on Thread 55852
[Info  - 20:12:55] Set config option 'enable_build_on_save' to true
[Info  - 20:12:55] Set config option 'semantic_tokens' to "partial"
[Info  - 20:12:55] Set config option 'inlay_hints_show_builtin' to false
[Info  - 20:12:55] Set config option 'inlay_hints_hide_redundant_param_names' to true
[Info  - 20:12:55] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to true
[Info  - 20:12:55] Set config option 'skip_std_references' to true
[Info  - 20:12:55] trying to start Build-On-Save for 'file:///home/lee/src/fresh'
Took 4ms to process response-"i_haz_configuration" on Thread 55852
Took 0ms to process request-1-textDocument/documentSymbol on Thread 55856
Took 0ms to process response-"progress" on Thread 55852
Took 0ms to process notification-other on Thread 55856
Took 0ms to process request-2-textDocument/documentSymbol on Thread 55854
[Error - 20:12:55] failed to read document '/home/lee/src/fresh/src/doesntexist.zig': error.FileNotFound
Took 0ms to process request-3-textDocument/inlayHint on Thread 55855
Took 0ms to process response-"semantic_tokens_refresh" on Thread 55852
Took 0ms to process response-"inlay_hints_refresh" on Thread 55852
[Error - 20:12:55] failed to read document '/home/lee/src/fresh/src/doesntexist.zig': error.FileNotFound
Took 0ms to process request-4-textDocument/semanticTokens/range on Thread 55856
Took 0ms to process request-5-textDocument/foldingRange on Thread 55853
@Techatrix
Copy link
Member

Zig does not provide the error message with a source location. See ziglang/zig#22930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants