Skip to content
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

Update refactor/splice/hlint/fourmolu/retrie/gadt plugin for GHC 9.4 #3317

Merged
merged 91 commits into from
Dec 21, 2022

Conversation

9999years
Copy link
Contributor

@9999years 9999years commented Nov 3, 2022

WIP tracking work on GHC 9.4 support for HLS plugins, particularly interested in hls-refactor-plugin.

We will need fourmolu to cut a new release before CI can start building this PR successfully. fourmolu/fourmolu#242 (comment)

@santiweight
Copy link
Collaborator

Let me know if you need any help with ls-refactor-plugin!

flake.nix Outdated
# The GHC 9.4 pull request builds upon these unpublished changes,
# which is why we include them.
#
# Also, there is no PR for these changes. The fourmolu maintainers
Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't true, for example the first commit is this pr: fourmolu/fourmolu#229

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, but this is just for testing. We'll have to release a new Fourmolu before this PR can build outside of Nix.

-- the error messages are significantly different from the ones without that, and
-- thus the code action triggers (such as in hls-refactor-plugin) are not fired properly.
-- So we disable the error demotion.
demoteIfDefer = id
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually couldn't figure out yet what would be the best action here. What I observed is that due to the error message difference between the case with and without defer, several hls-refactor-plugin suggestions are not fired (which uses matchRegex on error messages). With defer turned on, on GHC 9.4, there is no way to obtain source location (which relied on a fragile mechanism of parsing error message), so if we do not want to have this brute-force disabling, we need to make those suggestions and tests disabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Disabling deferred type errors will have an impact on many other IDE features, including diagnostics and code navigation. For this reason, I think the only alternatives here are:

  • update the regexes to account for the changes in 9.4 (incrementally, in other PRs if necessary)
  • migrate the suggestion providers to use typed diagnostics

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the feedback!
I will revert this disabling and mark the failed tests due to this with comments. The fix for the failed tests will not be small as previously the necessary error source location info was obtained from the error message which is gone with the deferred type error flag, so let us address that in a separate PR. After all, typed diagnostics is the best direction, so we had better move on in that direction.

Copy link
Contributor

Choose a reason for hiding this comment

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

reverted the change and mark the affected test as broken.

@pepeiborra
Copy link
Collaborator

retrie 1.2.1 is now available in Hackage

@9999years
Copy link
Contributor Author

Sorry I don't know how the GitHub reviewers mechanic really works I guess

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

Awesome, thank you very much!
I skimmed the changes for sanity but not correctness, so take this approval with a grain of salt 🙈

Copy link
Collaborator

@konn konn left a comment

Choose a reason for hiding this comment

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

LGTM again, as the CI has passed. Thanks!

@wz1000 wz1000 changed the title Update refactor/splice/hlint/fourmolu plugin for GHC 9.4 Update refactor/splice/hlint/fourmolu/retrie plugin for GHC 9.4 Dec 21, 2022
@wz1000
Copy link
Collaborator

wz1000 commented Dec 21, 2022

I've added 9.4 support for the retrie and gadt plugins to this PR.

@wz1000 wz1000 changed the title Update refactor/splice/hlint/fourmolu/retrie plugin for GHC 9.4 Update refactor/splice/hlint/fourmolu/retrie/gadt plugin for GHC 9.4 Dec 21, 2022
@wz1000 wz1000 added the merge me Label to trigger pull request merge label Dec 21, 2022
@mergify mergify bot merged commit 686fa1a into haskell:master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet