Skip to content

Support completions and better hovers for first class modules #7780

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 3 commits into from
Aug 22, 2025

Conversation

zth
Copy link
Member

@zth zth commented Aug 21, 2025

This improves the situation around first class modules, support completions for them, and enhancing hovers.

Ended up a bit more involved than I had hoped, but I think it worked out well in the end.

@zth zth requested review from Copilot and cristianoc August 21, 2025 19:11
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 ReScript language server support for first class modules by enabling completions and enhanced hover functionality. The changes ensure that first-class modules can be properly unpacked, have their signatures displayed in hovers, and provide appropriate completions for their members.

Key changes:

  • Added hover support to display module type signatures for first-class modules
  • Implemented completion support for accessing members of unpacked first-class modules
  • Enhanced pattern matching to properly register unpacked first-class modules in the analysis pipeline

Reviewed Changes

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

Show a summary per file
File Description
tests/analysis_tests/tests/src/FirstClassModules.res Test file demonstrating first-class module hover and completion scenarios
tests/analysis_tests/tests/src/expected/FirstClassModules.res.txt Expected test output showing hover info and completion results
analysis/src/StructureUtils.ml New utility for filtering duplicate items from module structures
analysis/src/ProcessExtra.ml Enhanced pattern processing to detect and register first-class module unpacks
analysis/src/ProcessCmt.ml Updated structure item processing to handle first-class module unpack patterns
analysis/src/Hover.ml Added support for displaying module type signatures when hovering over first-class modules
analysis/src/CompletionFrontEnd.ml Fixed scope handling for unpacked module patterns
analysis/src/CompletionBackEnd.ml Enhanced completion logic to support first-class module member access

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

Copy link

pkg-pr-new bot commented Aug 21, 2025

Open in StackBlitz

rescript

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/win32-x64

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

commit: dea5733

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

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

Sweet

@zth zth merged commit c6624e4 into master Aug 22, 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.

2 participants