diff --git a/src/inlay_hints.zig b/src/inlay_hints.zig index ef3fc23..4f88aa9 100644 --- a/src/inlay_hints.zig +++ b/src/inlay_hints.zig @@ -55,7 +55,7 @@ const Builder = struct { try self.hints.append(self.arena, .{ .position = position, - .label = .{ .string = label }, + .label = .{ .string = try std.fmt.allocPrint(self.arena, "{s}:", .{label}) }, .kind = types.InlayHintKind.Parameter, .tooltip = .{ .MarkupContent = .{ .kind = self.hover_kind, diff --git a/tests/lsp_features/inlay_hints.zig b/tests/lsp_features/inlay_hints.zig index 8660aa8..8969da8 100644 --- a/tests/lsp_features/inlay_hints.zig +++ b/tests/lsp_features/inlay_hints.zig @@ -120,7 +120,10 @@ fn testInlayHints(source: []const u8) !void { for (hints) |hint| { if (position.line != hint.position.line or position.character != hint.position.character) continue; - const actual_label = hint.label[0..hint.label.len]; + if(!std.mem.endsWith(u8, hint.label, ":")) { + try error_builder.msgAtLoc("label `{s}` must end with a colon!", new_loc, .err, .{ hint.label }); + } + const actual_label = hint.label[0..hint.label.len - 1]; if (!std.mem.eql(u8, expected_label, actual_label)) { try error_builder.msgAtLoc("expected label `{s}` here but got `{s}`!", new_loc, .err, .{ expected_label, actual_label });