Replies: 1 comment 1 reply
-
ZLS can resolve the types of an anytype parameter by collecting all callers of that function which has been implemented in #1067. Here is a code example that shows this feature in action: const std = @import("std");
fn callerWriter() !void {
const stdout = std.io.getStdOut().writer();
calleeWriter(stdout);
}
fn calleeWriter(writer: anytype) void {
writer. // ask for completions here
}
fn callerArray() !void {
const stdout = std.ArrayListUnmanaged(u8){};
calleeArray(stdout);
}
fn calleeArray(array: anytype) void {
array. // ask for completions here
} As far as I know, this feature has an issue with how it collects callers across different files which is why this may not always appear to work. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this idea that will make zls provide auto-completion for
anytype
.Beta Was this translation helpful? Give feedback.
All reactions