Replies: 2 comments 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. |
|
I have a use case for this (I know it is years later). I am using microzig to do some embedded development, and if when I use the compile-time pin configuration it allows me to do, then running |
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.All reactions