Skip to content
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

Inlay hints do not recognize the self parameter #1885

Open
vadim-za opened this issue May 4, 2024 · 0 comments
Open

Inlay hints do not recognize the self parameter #1885

vadim-za opened this issue May 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vadim-za
Copy link

vadim-za commented May 4, 2024

Zig Version

0.12.0

Zig Language Server Version

0.12.0

Client / Code Editor / Extensions

VS Code 1.86.1 (Windows), extension: Zig Language v0.5.7

Steps to Reproduce and Observed Behavior

Create the two following files in a VS Code project (this is a stripped down version of Windows COM interfaces implementation)

///! main.zig
const other = @import("other.zig");

pub fn main() void {
    const interface = other.IDerivedInterface{};
    interface.method(0, 1);
}
///! other.zig
pub const IUnknown = extern struct {
    pub usingnamespace Methods(@This());
    pub fn Methods(comptime T: type) type {
        _ = T; // autofix
        return struct {};
    }
};

pub const IBaseInterface = extern struct {
    pub usingnamespace Methods(@This());
    const Base = IUnknown;
    pub fn Methods(comptime T: type) type {
        return struct {
            pub usingnamespace Base.Methods(T);
            pub fn method(self: *T, arg1: i32, arg2: i32) void {
                _ = self; // autofix
                _ = arg1; // autofix
                _ = arg2; // autofix
            }
        };
    }
};

pub const IDerivedInterface = extern struct {
    pub usingnamespace Methods(@This());
    const Base = IBaseInterface;
    pub fn Methods(comptime T: type) type {
        return struct {
            pub usingnamespace Base.Methods(T);
        };
    }
};

Observed inlay hints in main.zig:

    interface.method(self: 0, arg1: 1);

Expected Behavior

Expected inlay hints in main.zig:

    interface.method(arg1: 0, arg2: 1);

Further info: if instead of other.zig the interface types are defined directly in main.zig, then there are no inlay hints at all.

Relevant log output

No response

@vadim-za vadim-za added the bug Something isn't working label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant