Skip to content

Use structured diagnostics in pragmas plugin #4620

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dyniec
Copy link
Contributor

@dyniec dyniec commented Jun 7, 2025

Proof of concept of structured diagnostics use. Requires some cleanup and testing.

Not ready to merge yet

@dyniec dyniec requested a review from eddiemundo as a code owner June 7, 2025 16:24
@dyniec dyniec force-pushed the structured-diagnostics branch 2 times, most recently from 079ed08 to 01648e0 Compare June 8, 2025 08:40
@dyniec dyniec changed the title WIP: Use structured diagnostics in pragmas plugin Use structured diagnostics in pragmas plugin Jun 8, 2025
@dyniec
Copy link
Contributor Author

dyniec commented Jun 8, 2025

Removed all temporary changes, and made it work on all types of errors (first version was working only on suggestions for type errors). Tested it on small repository and it seems to be working on example with LambdaCase and RecordWildCards missing.
As for provider suggestDisableWarning, I haven't looked deeply to find if there's good way to get data it needs from structured diagnostics, so it uses old diagnostics for now

@dyniec dyniec force-pushed the structured-diagnostics branch from 01648e0 to 305eaab Compare June 8, 2025 13:01
@dyniec
Copy link
Contributor Author

dyniec commented Jun 8, 2025

It seems that in ghc 9.6 GhcHints don't return TypeApplications and TypeSynonymInstances - see ghc9.6 vs current. I will test it further

@dyniec
Copy link
Contributor Author

dyniec commented Jun 8, 2025

Found the source for old messages ghc9.6 and it's indeed not structured but it was working fine enough with text search.

What remains to be verified is that ghc versions from 9.8 converted all error messages suggesting extensions to structured diagnostics. Hopefully that's the case as I'm implementing workaround that checks ghc versions and based on that uses either old approach or new.

@dyniec dyniec force-pushed the structured-diagnostics branch from 305eaab to 0ecb2ad Compare June 8, 2025 15:07
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.

LGTM, thanks! Just a couple of nitpicks.

Changes suggestion provider in pragmas plugin to
use structured diagnostics and ghc machinery to
generate hints
@dyniec dyniec force-pushed the structured-diagnostics branch from 0ecb2ad to 90eb271 Compare June 8, 2025 15:55
@dyniec
Copy link
Contributor Author

dyniec commented Jun 8, 2025

Part of #4605

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