diff --git a/src/features/hover.zig b/src/features/hover.zig index 920716389..4ce94906c 100644 --- a/src/features/hover.zig +++ b/src/features/hover.zig @@ -390,12 +390,14 @@ fn hoverNumberLiteral( switch (markup_kind) { .markdown => return try std.fmt.allocPrint(arena, + \\```md \\| Base | {[value]s:<[count]} | \\| ---- | {[dash]s:-<[count]} | \\| BIN | {[sign]s}0b{[number]b:<[len]} | \\| OCT | {[sign]s}0o{[number]o:<[len]} | \\| DEC | {[sign]s}{[number]d:<[len]} | \\| HEX | {[sign]s}0x{[number]X:<[len]} | + \\``` , .{ .sign = if (is_negative) "-" else "", .dash = "-", diff --git a/tests/lsp_features/hover.zig b/tests/lsp_features/hover.zig index 24b9d502a..da6d72a97 100644 --- a/tests/lsp_features/hover.zig +++ b/tests/lsp_features/hover.zig @@ -95,96 +95,114 @@ test "char literal" { try testHover( \\const foo = 'a'; , + \\```md \\| Base | Value | \\| ---- | --------- | \\| BIN | 0b1100001 | \\| OCT | 0o141 | \\| DEC | 97 | \\| HEX | 0x61 | + \\``` ); try testHover( \\const foo = '\''; , + \\```md \\| Base | Value | \\| ---- | -------- | \\| BIN | 0b100111 | \\| OCT | 0o47 | \\| DEC | 39 | \\| HEX | 0x27 | + \\``` ); try testHover( \\const foo = '\''; , + \\```md \\| Base | Value | \\| ---- | -------- | \\| BIN | 0b100111 | \\| OCT | 0o47 | \\| DEC | 39 | \\| HEX | 0x27 | + \\``` ); } test "integer literal" { try testHover( \\const foo = 42; , + \\```md \\| Base | Value | \\| ---- | -------- | \\| BIN | 0b101010 | \\| OCT | 0o52 | \\| DEC | 42 | \\| HEX | 0x2A | + \\``` ); try testHover( \\const foo = -42; , + \\```md \\| Base | Value | \\| ---- | --------- | \\| BIN | -0b101010 | \\| OCT | -0o52 | \\| DEC | -42 | \\| HEX | -0x2A | + \\``` ); try testHover( \\const foo = 0b101010; , + \\```md \\| Base | Value | \\| ---- | -------- | \\| BIN | 0b101010 | \\| OCT | 0o52 | \\| DEC | 42 | \\| HEX | 0x2A | + \\``` ); try testHover( \\const foo = -0b101010; , + \\```md \\| Base | Value | \\| ---- | --------- | \\| BIN | -0b101010 | \\| OCT | -0o52 | \\| DEC | -42 | \\| HEX | -0x2A | + \\``` ); try testHover( \\const foo = 0x2A; , + \\```md \\| Base | Value | \\| ---- | -------- | \\| BIN | 0b101010 | \\| OCT | 0o52 | \\| DEC | 42 | \\| HEX | 0x2A | + \\``` ); try testHover( \\const foo = -0x2A; , + \\```md \\| Base | Value | \\| ---- | --------- | \\| BIN | -0b101010 | \\| OCT | -0o52 | \\| DEC | -42 | \\| HEX | -0x2A | + \\``` ); try testHoverWithOptions( \\const foo = 42;