zigtools / zls-vscode

Deprecated, please use https://github.com/ziglang/vscode-zig
https://github.com/ziglang/vscode-zig
MIT License
85 stars 15 forks source link

Auto complete doesn't seem to work in vscode #47

Closed elgs closed 2 years ago

elgs commented 2 years ago

zls-vscode version: v1.1.2 zig version: 0.9.1

I expect after typing a dot the member variables/methods will be shown in a pop up list, but it doesn't.

SuperAuguste commented 2 years ago

Please provide more information such as an example of broken code :)

elgs commented 2 years ago

Just as simple as:

const std = @import("std");

pub fn main() !void {
  std.
}

When the dot is typed, I expect an auto complete to pop up, but it doesn't.

But I figured out the problem is on zls 0.9.0.

I was able to get it work by building zls from source, using:

git clone --recurse-submodules https://github.com/zigtools/zls
cd zls
zig build -Drelease-safe
./zig-out/bin/zls config # Configure ZLS

However, zig 0.9.1 cannot compile the latest code of zls at this very moment of time. So I had to use HEAD version of zig by:

brew install zig --HEAD

And it worked. Then I uninstalled the HEAD version of zig and installed 0.9.1 again, and it still works.

SuperAuguste commented 2 years ago

Ah ok, good to know! I would generally recommend using the HEAD version of zig instead of 0.9.1 but that's all up to you.

elgs commented 2 years ago

I am not a hardcore zig user yet. The reason I am not using zig HEAD is I upgrade my brew packages daily. I expect I would get a lot of zig updates which will require building from the source if I'd use the HEAD. I wish zig will release more frequently.