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

Conversation

mediremi
Copy link
Contributor

@mediremi mediremi commented Aug 17, 2025

I've made hover information for modules more consistent with type hover information by adding a Markdown.divider between a module's doc string and its contents.

Thanks to the divider, it's easier to tell where a doctring ends and where the module type definition starts:

/**
 My module with a doc comment.

 ## Examples
 ```rescript
 Foo.bar()
 Foo.baz()
 \```
*/
module type Foo = {
  let bar: unit => unit
  let baz: unit => unit
}
Before After
image image

@mediremi mediremi marked this pull request as ready for review August 17, 2025 15:36
Copy link

pkg-pr-new bot commented Aug 17, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7775

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7775

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7775

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7775

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7775

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7775

commit: 9ba2bb6

@nojaf
Copy link
Member

nojaf commented Aug 18, 2025

Too bad this doesn't come with some padding.

@zth
Copy link
Member

zth commented Aug 18, 2025

IIRC I faked some padding with empty markdown (or was it code?) blocks. Maybe worth trying? Might still be some code in there for that.

@mediremi mediremi force-pushed the module-hover-divider branch from 3099d6d to 9ba2bb6 Compare August 18, 2025 09:51
@mediremi
Copy link
Contributor Author

I've added some spacing with Markdown.spacing 👍

@zth zth requested review from tsnobip, Copilot and zth and removed request for tsnobip August 18, 2025 09:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the visual separation in module hover information by adding a markdown divider between a module's documentation and its type definition, making it consistent with how type hover information is displayed.

  • Adds Markdown.divider and Markdown.spacing between module docstrings and module type definitions
  • Updates test expectations to reflect the new formatting with dividers
  • Improves readability by clearly separating documentation from type information

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
analysis/src/Hover.ml Adds markdown divider and spacing after module docstrings
tests/analysis_tests/tests/src/expected/Hover.res.txt Updates test expectations to include new divider formatting
CHANGELOG.md Documents the new feature addition

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zth zth enabled auto-merge (squash) August 18, 2025 09:54
@zth zth merged commit 271a112 into rescript-lang:master Aug 18, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants