From a44cfdc451e287958da4e2bd347ce01b2a2d4410 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Sun, 11 Sep 2022 01:50:45 +0200 Subject: [PATCH] correctly handle anytype in inlay hint tooltips --- src/inlay_hints.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/inlay_hints.zig b/src/inlay_hints.zig index 403e1fa..077b340 100644 --- a/src/inlay_hints.zig +++ b/src/inlay_hints.zig @@ -118,10 +118,15 @@ fn writeCallHint(builder: *Builder, arena: *std.heap.ArenaAllocator, store: *Doc const no_alias = if (param.comptime_noalias) |t| token_tags[t] == .keyword_noalias or token_tags[t - 1] == .keyword_noalias else false; const comp_time = if (param.comptime_noalias) |t| token_tags[t] == .keyword_comptime or token_tags[t - 1] == .keyword_comptime else false; + const tooltip = if (param.anytype_ellipsis3) |token| + if (token_tags[token] == .keyword_anytype) "anytype" else "" + else + decl_tree.getNodeSource(param.type_expr); + try builder.appendParameterHint( tree.tokenLocation(0, tree.firstToken(call.ast.params[i])), decl_tree.tokenSlice(param.name_token.?), - decl_tree.getNodeSource(param.type_expr), + tooltip, no_alias, comp_time, );