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

Link from error codes to the error message index #3246

Open
david-christiansen opened this issue Oct 5, 2022 · 7 comments
Open

Link from error codes to the error message index #3246

david-christiansen opened this issue Oct 5, 2022 · 7 comments
Labels
GHC issues with particular GHC versions level: easy The issue is suited for beginners type: enhancement New feature or request ZuriHac This issue is suitable for ZuriHac Hacking sessions

Comments

@david-christiansen
Copy link

david-christiansen commented Oct 5, 2022

Is your enhancement request related to a problem? Please describe.

Some GHC error messages and warnings can be confusing.

Describe the solution you'd like

The Haskell Foundation has started a project to assign unique numbers to each error or warning emitted by GHC, and a community-driven web site that associates documentation with each code. The codes will be part of GHC 9.6. I'd like to see HLS include links to this documentation from messages in some convenient way.

Describe alternatives you've considered

None.

Additional context

All codes emitted by GHC match GHC-(0-9){5}. The message index will have addresses of the form https://errors.haskell.org/messages/GHC-NNNNN. The index is maintained at https://github.com/haskellfoundation/error-message-index/.

@michaelpj michaelpj added GHC issues with particular GHC versions status: blocked Not actionable, because blocked by upstream/GHC etc. and removed status: needs triage labels Oct 5, 2022
@michaelpj
Copy link
Collaborator

Need to come back to this when we've got basic 9.6 support.

@michaelpj
Copy link
Collaborator

We can actually put this in the Diagnostic: it has a code field and a codeDescription field that's a URI, so perfect.

@michaelpj michaelpj added level: easy The issue is suited for beginners and removed status: blocked Not actionable, because blocked by upstream/GHC etc. labels Jan 16, 2024
@michaelpj michaelpj added the ZuriHac This issue is suitable for ZuriHac Hacking sessions label May 1, 2024
@michaelpj
Copy link
Collaborator

I think we can do this already without structured diagnostics: we can just regex it out of the diagnostic message easily enough.

@michaelpj
Copy link
Collaborator

I have some code for this, but annoyingly we don't actually render the error codes already! So it's confusing what to do - do we render them (thus making users see them in the messages), or not (and not be able to pull them out)... 🤔

@michaelpj
Copy link
Collaborator

Hacky code here: https://github.com/haskell/haskell-language-server/tree/mpj/error-index

@michaelpj
Copy link
Collaborator

Hmmm. I feel like I am going in the wrong direction here by smuggling additional information into messages only to parse it out later. Perhaps the right thing to do is just to implement the structured diagnostics stuff 🤔

@dylan-thinnes
Copy link

Working on this for ZuriHac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GHC issues with particular GHC versions level: easy The issue is suited for beginners type: enhancement New feature or request ZuriHac This issue is suitable for ZuriHac Hacking sessions
Projects
Status: In Progress
Development

No branches or pull requests

3 participants