Skip to content

Migrate all plugins and ghcide to use structured diagnostics #4605

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
1 of 22 tasks
fendor opened this issue May 30, 2025 · 0 comments
Open
1 of 22 tasks

Migrate all plugins and ghcide to use structured diagnostics #4605

fendor opened this issue May 30, 2025 · 0 comments
Labels
Hackathon This issue is suitable for hackathon sessions type: enhancement New feature or request

Comments

@fendor
Copy link
Collaborator

fendor commented May 30, 2025

HLS uses in many locations regexes to extract information out of GHC diagnostics to then offer code actions based on them.
This has served us well for many years, but it is time for an improvement!
GHC has structured diagnostics since GHC 9.4 (at least), but HLS isn't really using them, even though we keep them around since #4433.

This issue tracks the effort to update the full HLS codebase to use structured diagnostics instead of handwritten regex matchers.

  • ghcide (huge amount of work)
  • hls-alternate-number-format-plugin
  • hls-call-hierarchy-plugin
  • hls-change-type-signature-plugin
  • hls-class-plugin (Draft: Migrate hls-class-plugin to use structured diagnostics #4472 @fendor)
  • hls-code-range-plugin
  • hls-eval-plugin
  • hls-explicit-fixity-plugin
  • hls-explicit-imports-plugin
  • hls-explicit-record-fields-plugin
  • hls-gadt-plugin
  • hls-hlint-plugin
  • hls-module-name-plugin
  • hls-notes-plugin
  • hls-overloaded-record-dot-plugin
  • hls-pragmas-plugin
  • hls-qualify-imported-names-plugin
  • hls-refactor-plugin (huge amount of work)
  • hls-rename-plugin
  • hls-retrie-plugin
  • hls-splice-plugin
  • hls-stan-plugin

Not all the listed plugins actually benefit from structured diagnostics, but we need to check which ones need to be updated. For example, I don't hls-stan-plugin uses ghc in any way, so will likely not need updating.
I will update the list as time goes on.

The task for each of these plugins/packages would be to check whether the plugin needs updating, try to migrate it to use structured diagnostics or document what is missing to migrate them to structured diagnostics. This may require us to send issues to GHC upstream.

If you need inspiration for what this migration may look like, the PR #4472 migrates the hls-class-plugin to use structured diagnostics.

I am planning to present this issue at ZuriHac, if you want to work on migrating a plugin, please comment here and I will update the table.

@fendor fendor added type: enhancement New feature or request Hackathon This issue is suitable for hackathon sessions labels May 30, 2025
@fendor fendor pinned this issue May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hackathon This issue is suitable for hackathon sessions type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant