Skip to content

Commit 271a112

Browse files
authored
Add markdown divider between module doc and module type in hover information (#7775)
* Add markdown divider between module doc and module type in hover information * Add CHANGELOG entry * Format code * Add padding between module docstring and type hover information
1 parent dfa1610 commit 271a112

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#### :rocket: New Feature
2020

21+
- Add markdown divider between module doc and module type in hover information. https://github.com/rescript-lang/rescript/pull/7775
2122
- Show docstrings before type expansions on hover. https://github.com/rescript-lang/rescript/pull/7774
2223

2324
#### :bug: Bug fix

analysis/src/Hover.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ let showModuleTopLevel ~docstring ~isType ~name (topLevel : Module.item list) =
2626
let doc =
2727
match docstring with
2828
| [] -> ""
29-
| _ :: _ -> "\n" ^ (docstring |> String.concat "\n") ^ "\n"
29+
| _ :: _ ->
30+
"\n"
31+
^ (docstring |> String.concat "\n")
32+
^ Markdown.divider ^ Markdown.spacing
3033
in
3134
Some (doc ^ full)
3235

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Hover src/Hover.res 6:7
88
{"contents": {"kind": "markdown", "value": "```rescript\nmodule Id: {\n type x = int\n}\n```"}}
99

1010
Hover src/Hover.res 19:11
11-
{"contents": {"kind": "markdown", "value": "\nThis module is commented\n```rescript\nmodule Dep: {\n let customDouble: int => int\n}\n```"}}
11+
{"contents": {"kind": "markdown", "value": "\nThis module is commented\n---\n\n```\n \n```\n```rescript\nmodule Dep: {\n let customDouble: int => int\n}\n```"}}
1212

1313
Hover src/Hover.res 22:11
1414
{"contents": {"kind": "markdown", "value": "```rescript\nint => int\n```\n---\nSome doc comment"}}
@@ -343,7 +343,7 @@ Path x
343343
{"contents": {"kind": "markdown", "value": "```rescript\nbool\n```"}}
344344

345345
Hover src/Hover.res 278:8
346-
{"contents": {"kind": "markdown", "value": "\n [`Belt.Array`]()\n\n **mutable array**: Utilities functions\n\n```rescript\nmodule Array: {\n module Id\n module Array\n module SortArray\n module MutableQueue\n module MutableStack\n module List\n module Range\n module Set\n module Map\n module MutableSet\n module MutableMap\n module HashSet\n module HashMap\n module Option\n module Result\n module Int\n module Float\n}\n```"}}
346+
{"contents": {"kind": "markdown", "value": "\n [`Belt.Array`]()\n\n **mutable array**: Utilities functions\n\n---\n\n```\n \n```\n```rescript\nmodule Array: {\n module Id\n module Array\n module SortArray\n module MutableQueue\n module MutableStack\n module List\n module Range\n module Set\n module Map\n module MutableSet\n module MutableMap\n module HashSet\n module HashMap\n module Option\n module Result\n module Int\n module Float\n}\n```"}}
347347

348348
Hover src/Hover.res 281:6
349349
{"contents": {"kind": "markdown", "value": "```rescript\ntype aliased = variant\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"}}

0 commit comments

Comments
 (0)