zigtools / zls

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

No C++ code completion on master branch #1970

Closed DasGandlaf closed 1 month ago

DasGandlaf commented 1 month ago

Zig Version

0.14.0-dev.367+a57479afc

Zig Language Server Version

3b9216e4444395ab1ee35911e9927571f8291fad

Client / Code Editor / Extensions

nvim 0.10 with lsp (nvim-lspconfig)

Steps to Reproduce and Observed Behavior

I use:

const rl = @cImport({
    @cInclude("raylib.h");
});

rl. does not autocomplete anything.

Expected Behavior

Autocompletion should work.

(It does work in the official zls 0.13.0 release, but not on the current master)

Relevant log output

No response

Techatrix commented 1 month ago

You could provide more detailed information on how you have installed/setup raylib? Did you create a build.zig project and if so, what did you change exactly? Providing the Log Output of ZLS is also helpful. It may even show you why ZLS was unable to provide you with completions on a @cImport.

FYI: I would recommend to use dedicated package for raylib with Zig like https://github.com/Not-Nik/raylib-zig

DasGandlaf commented 1 month ago

I don't think the problem is with how I built Raylib. When I use the official zls 0.13.0 release, there is code completion without any issues. Only on master there is none. I've updated the issue to be more clear.

I built Raylib with cmake to a .dll linked with a static .lib file.

The log is definitely worth checking out, I'll let you know when I have any new info ;)

And thanks for the raylib-zig suggestion!

nothke commented 1 month ago

Can confirm C autocompletion doesn't work, I used it with sokol and cimgui, and just struggled with this for almost 2 hours on stream (starting here) to realize that it was zls master's fault because when I switched to 0.13 it worked just fine.

weskoerber commented 1 month ago

I can't get @cIncludes to work, either. I think my issue is specific to non-system, relative paths.

I'm not sure if this is the same issue or not. If my comment doesn't belong here, I'm happy to open up a new issue :)

Techatrix commented 1 month ago

I'm not sure if this is the same issue or not. If my comment doesn't belong here, I'm happy to open up a new issue :)

Please open a new issue and provide as much information about your environment as possible. Zig version, ZLS version, the build.zig file, ZLS log output, etc. Without them I would need to do a lot of guesswork to figure out what is going on.

Techatrix commented 1 month ago

You could provide more detailed information on how you have installed/setup raylib?

Since this request has not been met, I have no way of reproducing/investigating this issue. So I'm assuming this is the same problem that caused #1985 which was fixed by #1983.

If there is still an issue with cImport, feel free to open a new issue.

weskoerber commented 1 month ago

I'm not sure if this is the same issue or not. If my comment doesn't belong here, I'm happy to open up a new issue :)

Please open a new issue and provide as much information about your environment as possible. Zig version, ZLS version, the build.zig file, ZLS log output, etc. Without them I would need to do a lot of guesswork to figure out what is going on.

My issue was totally unrelated, and entirely caused my me. Apologies for the noise...