Skip to content

Add markdown divider between module doc and module type in hover information #7775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#### :rocket: New Feature

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

#### :bug: Bug fix
Expand Down
5 changes: 4 additions & 1 deletion analysis/src/Hover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ let showModuleTopLevel ~docstring ~isType ~name (topLevel : Module.item list) =
let doc =
match docstring with
| [] -> ""
| _ :: _ -> "\n" ^ (docstring |> String.concat "\n") ^ "\n"
| _ :: _ ->
"\n"
^ (docstring |> String.concat "\n")
^ Markdown.divider ^ Markdown.spacing
in
Some (doc ^ full)

Expand Down
4 changes: 2 additions & 2 deletions tests/analysis_tests/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hover src/Hover.res 6:7
{"contents": {"kind": "markdown", "value": "```rescript\nmodule Id: {\n type x = int\n}\n```"}}

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

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

Hover src/Hover.res 278:8
{"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```"}}
{"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```"}}

Hover src/Hover.res 281:6
{"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"}}
Expand Down
Loading