@@ -137,13 +137,21 @@ let expandTypes ~file ~package ~supportsMarkdownLinks typ =
137
137
`Default )
138
138
139
139
(* Produces a hover with relevant types expanded in the main type being hovered. *)
140
- let hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ =
141
- let typeString = Markdown. codeBlock ( typ |> Shared. typeToString) in
140
+ let hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks ? constructor
141
+ typ =
142
142
let expandedTypes, expansionType =
143
143
expandTypes ~file ~package ~supports MarkdownLinks typ
144
144
in
145
145
match expansionType with
146
- | `Default -> typeString :: expandedTypes |> String. concat " \n "
146
+ | `Default ->
147
+ let typeString = Shared. typeToString typ in
148
+ let typeString =
149
+ match constructor with
150
+ | Some constructor ->
151
+ typeString ^ " \n " ^ CompletionBackEnd. showConstructor constructor
152
+ | None -> typeString
153
+ in
154
+ Markdown. codeBlock typeString :: expandedTypes |> String. concat " \n "
147
155
| `InlineType -> expandedTypes |> String. concat " \n "
148
156
149
157
(* Leverages autocomplete functionality to produce a hover for a position. This
@@ -256,8 +264,9 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
256
264
| Const_int64 _ -> " int64"
257
265
| Const_bigint _ -> " bigint" ))
258
266
| Typed (_ , t , locKind ) ->
259
- let fromType ~docstring typ =
260
- ( hoverWithExpandedTypes ~file ~package ~supports MarkdownLinks typ,
267
+ let fromType ~docstring ?constructor typ =
268
+ ( hoverWithExpandedTypes ~file ~package ~supports MarkdownLinks
269
+ ?constructor typ,
261
270
docstring )
262
271
in
263
272
let parts =
@@ -272,11 +281,9 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
272
281
typeString :: docstring
273
282
| `Constructor constructor ->
274
283
let typeString, docstring =
275
- t |> fromType ~docstring: constructor.docstring
284
+ t |> fromType ~docstring: constructor.docstring ~constructor
276
285
in
277
- typeString
278
- :: Markdown. codeBlock (CompletionBackEnd. showConstructor constructor)
279
- :: docstring
286
+ typeString :: docstring
280
287
| `Field ->
281
288
let typeString, docstring = t |> fromType ~docstring in
282
289
typeString :: docstring)
0 commit comments