diff --git a/src/features/inlay_hints.zig b/src/features/inlay_hints.zig index 8fb4ad8..6e80af3 100644 --- a/src/features/inlay_hints.zig +++ b/src/features/inlay_hints.zig @@ -87,7 +87,10 @@ fn writeCallHint(builder: *Builder, call: Ast.full.Call, decl_handle: Analyser.D var i: usize = 0; var it = fn_proto.iterate(&decl_tree); - if (try builder.analyser.hasSelfParam(decl_handle.handle, fn_proto)) { + if (tree.tokens.items(.tag)[call.ast.lparen - 2] == .period and + call.ast.params.len + 1 == fn_proto.ast.params.len and + try builder.analyser.hasSelfParam(decl_handle.handle, fn_proto)) + { _ = ast.nextFnParam(&it); } diff --git a/tests/lsp_features/inlay_hints.zig b/tests/lsp_features/inlay_hints.zig index 111477a..762d91a 100644 --- a/tests/lsp_features/inlay_hints.zig +++ b/tests/lsp_features/inlay_hints.zig @@ -48,6 +48,18 @@ test "inlayhints - function self parameter" { \\const foo: Foo = .{}; \\const _ = foo.bar(5,""); ); + try testInlayHints( + \\const Foo = struct { pub fn bar(self: Foo, alpha: u32, beta: []const u8) void {} }; + \\const _ = Foo.bar(undefined,5,""); + ); + try testInlayHints( + \\const Foo = struct { + \\ pub fn bar(self: Foo, alpha: u32, beta: []const u8) void {} + \\ pub fn foo() void { + \\ bar(undefined,5,""); + \\ } + \\}; + ); } test "inlayhints - builtin call" {