diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a840e1773..9c1dac27e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/analysis/src/Hover.ml b/analysis/src/Hover.ml index 3b6367c04a..fc8a8d0573 100644 --- a/analysis/src/Hover.ml +++ b/analysis/src/Hover.ml @@ -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) diff --git a/tests/analysis_tests/tests/src/expected/Hover.res.txt b/tests/analysis_tests/tests/src/expected/Hover.res.txt index 60d7454f76..f9f1746e15 100644 --- a/tests/analysis_tests/tests/src/expected/Hover.res.txt +++ b/tests/analysis_tests/tests/src/expected/Hover.res.txt @@ -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"}} @@ -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"}}