zls icon indicating copy to clipboard operation
zls copied to clipboard

Convert translate-c failure into diagnostics

Open techatrix opened this issue 4 years ago • 0 comments

Code that uses @cImport and refers to non existent files doesn't report any diagnostics which makes debugging much harder.

const c = @cImport({
    @cInclude("non/existent/file.h");
});

the error logs contain

error: (default): zig translate-c process failed, code: 1, stderr: '/home/techatrix/.cache/zls/cimport.h:1:10: 'non/existent/file.h' file not found

It should be fairly simple to convert the errors into diagnostics with textDocument/publishDiagnostics. The same could also be applied to regular @import.

techatrix avatar Sep 17 '22 19:09 techatrix