haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Link from error codes to the error message index

Open david-christiansen opened this issue 3 years ago • 7 comments

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/.

david-christiansen avatar Oct 05 '22 11:10 david-christiansen

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

michaelpj avatar Oct 05 '22 11:10 michaelpj

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

michaelpj avatar Oct 05 '22 11:10 michaelpj

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

michaelpj avatar May 01 '24 12:05 michaelpj

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)... :thinking:

michaelpj avatar Jun 06 '24 15:06 michaelpj

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

michaelpj avatar Jun 06 '24 15:06 michaelpj

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 :thinking:

michaelpj avatar Jun 06 '24 15:06 michaelpj

Working on this for ZuriHac

dylan-thinnes avatar Jun 09 '24 13:06 dylan-thinnes