Merge pull request #642 from Techatrix/dev

Correctly handle anytype in inlay hint tooltips
This commit is contained in:
Techatrix 2022-09-11 01:22:05 +00:00 committed by GitHub
commit 58a83ffd25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,
);