add colon to inlay hint label (#944)
This commit is contained in:
parent
e055f9d15c
commit
2857237f74
@ -55,7 +55,7 @@ const Builder = struct {
|
|||||||
|
|
||||||
try self.hints.append(self.arena, .{
|
try self.hints.append(self.arena, .{
|
||||||
.position = position,
|
.position = position,
|
||||||
.label = .{ .string = label },
|
.label = .{ .string = try std.fmt.allocPrint(self.arena, "{s}:", .{label}) },
|
||||||
.kind = types.InlayHintKind.Parameter,
|
.kind = types.InlayHintKind.Parameter,
|
||||||
.tooltip = .{ .MarkupContent = .{
|
.tooltip = .{ .MarkupContent = .{
|
||||||
.kind = self.hover_kind,
|
.kind = self.hover_kind,
|
||||||
|
@ -120,7 +120,10 @@ fn testInlayHints(source: []const u8) !void {
|
|||||||
for (hints) |hint| {
|
for (hints) |hint| {
|
||||||
if (position.line != hint.position.line or position.character != hint.position.character) continue;
|
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)) {
|
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 });
|
try error_builder.msgAtLoc("expected label `{s}` here but got `{s}`!", new_loc, .err, .{ expected_label, actual_label });
|
||||||
|
Loading…
Reference in New Issue
Block a user