zigtools / zls

A Zig language server supporting Zig developers with features like autocomplete and goto definition
MIT License
3.05k stars 300 forks source link

failed to translate cimport: error.Timeout #1234

Closed cactusbento closed 1 year ago

cactusbento commented 1 year ago

Zig Version

0.10.1

Zig Language Server Version

0.11.0-dev.479+c28a59c

Steps to Reproduce

  1. Build zls for 0.10.1 using zig 0.11.0-dev.3395+1e7dcaa3a.
    $ git clone https://github.com/zigtools/zls; cd zls
    $ ln -sr ~/.local/share/zig/0.11.0-3395/zig zig
    $ ./zig build -Ddata_version=0.10.1
  2. import a C header into zig source file
  3. Attempt to get completions
    
    const c = @cImport({
    @cInclude("raylib.h");
    });

fn main() !void { // No completions provided by zls c.SetTarg }


### Expected Behavior

zls generates completions for use in nvim-lspconfig.
Expect completion for `c.SetTargetFps(60)`

(This works properly with the latest version of zig(0.11.0-3395))

### Actual Behavior

zls attempts to generate completions for the C header, but fails with a timeout.

[ERROR][2023-06-13 12:22:56] .../vim/lsp/rpc.lua:734 "rpc" "/home/cactus/.local/bin/zls" "stderr" "error: (translate_c): failed zig translate-c command:\n/usr/bin/zig translate-c --zig-lib-dir /usr/lib/zig --cache-dir /home/cactus/.cache/zls -lc --listen=- -I /usr/local/include -I /usr/include/x86_64-linux-gnu -I /usr/include /home/cactus/.cache/zls/cimport.h\nerror:error.Timeout\n\n" [ERROR][2023-06-13 12:22:56] .../vim/lsp/rpc.lua:734 "rpc" "/home/cactus/.local/bin/zls" "stderr" "error: (store ): failed to translate cimport: error.Timeout\n"

leecannon commented 1 year ago

zls master only supports zig master https://github.com/zigtools/zls/issues/1020, if you want to use zig 0.10 you need to build zls from the 0.10 tag

the -Ddata_version build option should probably be removed

cactusbento commented 1 year ago

I see. I'll stick with zls 0.10.0 for now.