Skip to content

Commit 6187495

Browse files
Update parameter in hoverSymbolResolved
1 parent 35a74d5 commit 6187495

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/features/hover.zig

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,15 @@ fn hoverSymbolResolved(
122122
markup_kind: types.MarkupKind,
123123
doc_strings: []const []const u8,
124124
def_str: []const u8,
125-
resolved_type_str: ?[]const u8,
125+
resolved_type_str: []const u8,
126126
referenced_types: []const Analyser.ReferencedType,
127127
) error{OutOfMemory}![]const u8 {
128128
var hover_text: std.ArrayListUnmanaged(u8) = .empty;
129129
const writer = hover_text.writer(arena);
130130
if (markup_kind == .markdown) {
131131
for (doc_strings) |doc|
132132
try writer.print("{s}\n\n", .{doc});
133-
try writer.print("```zig\n{s}\n```", .{def_str});
134-
if (resolved_type_str) |s|
135-
try writer.print("\n```zig\n({s})\n```", .{s});
133+
try writer.print("```zig\n{s}\n```\n```zig\n({s})\n```", .{ def_str, resolved_type_str });
136134
if (referenced_types.len > 0)
137135
try writer.print("\n\n" ++ "Go to ", .{});
138136
for (referenced_types, 0..) |ref, index| {
@@ -145,9 +143,7 @@ fn hoverSymbolResolved(
145143
} else {
146144
for (doc_strings) |doc|
147145
try writer.print("{s}\n\n", .{doc});
148-
try writer.print("{s}", .{def_str});
149-
if (resolved_type_str) |s|
150-
try writer.print("\n({s})", .{s});
146+
try writer.print("{s}\n({s})", .{ def_str, resolved_type_str });
151147
}
152148

153149
return hover_text.items;

tests/lsp_features/hover.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ test "type reference cycle" {
904904
\\) void
905905
\\```
906906
\\```zig
907-
\\(unknown)
907+
\\(fn (anytype, (unknown value)) void)
908908
\\```
909909
);
910910
}

0 commit comments

Comments
 (0)