Skip to content

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

Open
@leecannon

Description

@leecannon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions