-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotations are incorrect #1897
Comments
The following code snippet resolves const std = @import("std");
test {
const splits = std.ArrayList([][]const u8).init(undefined);
for (splits.items) |item| {
_ = item;
}
} I suspect this to be related to #1392. |
I can't reproduce this with Zig 0.12.0 and ZLS 0.12.0. You could you post ZLS's log output? (VSCode: Bottom Panel -> Output -> Zig Language Server) |
kazam_qfoenyyr.movie.webmI got the issue, type annotations are wrong when there's for loop iteration before it. You can see in the video. Here's the code for easy copy paste. const std = @import("std");
const Fpp = struct {
tokens: std.ArrayList([][]const u8),
const Self = @This();
pub fn free(self: *Self) void {
for (self.tokens.items) |token| {
_ = token;
}
self.tokens.deinit();
}
test {
const splits = std.ArrayList([][]const u8).init(undefined);
for (splits.items) |item| {
_ = item;
}
}
};
test {
const splits = std.ArrayList([][]const u8).init(undefined);
for (splits.items) |item| {
_ = item;
}
}
ZLS logs are clean info : ( main ): Starting ZLS 0.12.0 @ '/home/akhil/.config/Code/User/globalStorage/ziglang.vscode-zig/zls_install/zls'
info : (server): Client is 'Visual Studio Code-1.89.1'
info : (server): No config file zls.json found. This is not an error.
info : (server): Set config option 'global_cache_path' to '/home/akhil/.cache/zls'
info : (server): Set config option 'semantic_tokens' to 'partial'
info : (server): Set config option 'builtin_path' to '/home/akhil/.cache/zls/builtin.zig'
info : (server): Set config option 'zig_lib_path' to '/home/akhil/.config/Code/User/globalStorage/ziglang.vscode-zig/zig_install/lib'
info : (server): Set config option 'zig_exe_path' to '/home/akhil/.config/Code/User/globalStorage/ziglang.vscode-zig/zig_install/zig'
info : (server): Set config option 'build_runner_path' to '/home/akhil/.cache/zls/build_runner_0.12.0.zig'
info : (server): Set config option 'build_runner_global_cache_path' to '/home/akhil/.cache/zig' |
This is the same underlying issue as #1841 |
Zig Version
0.12.0
Zig Language Server Version
0.12.0
Client / Code Editor / Extensions
VsCode
Steps to Reproduce and Observed Behavior
I've declared an arraylist containing slice of u8 slices.
var splits = std.ArrayList([][]const u8).init(allocator);
While iterating I get wrong annotation but the hover gives correct type info, as seen in the above image
Expected Behavior
Both should be consistent
Relevant log output
No response
The text was updated successfully, but these errors were encountered: