Skip to content

Commit 5f7ba41

Browse files
committed
reorder constructor hover details so that the constructor + eventual docstring ends up on top before the full variant definition
1 parent 704c5dc commit 5f7ba41

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

analysis/src/Hover.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
251251
|> List.map (fun (t, _) -> Shared.typeToString t)
252252
|> String.concat ", " |> Printf.sprintf "(%s)"
253253
in
254-
typeString :: Markdown.codeBlock (txt ^ argsString) :: docstring
254+
[Markdown.codeBlock (txt ^ argsString)] @ docstring @ [typeString]
255255
| `Field ->
256256
let typeString, docstring = t |> fromType ~docstring in
257257
typeString :: docstring)

analysis/tests/src/Hover.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,8 @@ let x: recordWithDocstringField = {
248248

249249
let someField = x.someField
250250
// ^hov
251+
252+
type variant = | /** Cool variant! */ CoolVariant | /** Other cool variant */ OtherCoolVariant
253+
254+
let coolVariant = CoolVariant
255+
// ^hov

analysis/tests/src/expected/Hover.res.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,6 @@ Completable: Cpath Value[x].someField
189189
Hover src/Hover.res 248:19
190190
{"contents": {"kind": "markdown", "value": "```rescript\nbool\n```\n\n Mighty fine field here. "}}
191191

192+
Hover src/Hover.res 253:20
193+
{"contents": {"kind": "markdown", "value": "```rescript\nCoolVariant\n```\n\n Cool variant! \n\n```rescript\nvariant\n```\n\n---\n\n```\n \n```\n```rescript\ntype variant = CoolVariant | OtherCoolVariant\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C251%2C0%5D)\n"}}
194+

0 commit comments

Comments
 (0)