File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Top Open diff view settings
ghcide/src/Development/IDE/Types Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Top Open diff view settings Original file line number Diff line number Diff line change @@ -102,20 +102,19 @@ ideErrorFromLspDiag lspDiag fdFilePath mbOrigMsg =
102102 fdLspDiagnostic =
103103 lspDiag
104104 & attachReason (fmap (diagnosticReason . errMsgDiagnostic) mbOrigMsg)
105- & setGhcCode mbOrigMsg
105+ & attachDiagnosticCode ((diagnosticCode . errMsgDiagnostic) =<< mbOrigMsg)
106106 in
107107 FileDiagnostic {.. }
108108
109- -- | Set the code of the 'LSP.Diagnostic' to the GHC diagnostic code which is linked
109+ -- | Set the code of the 'LSP.Diagnostic' to the GHC diagnostic code, and include the link
110110-- to https://errors.haskell.org/.
111- setGhcCode :: Maybe (MsgEnvelope GhcMessage ) -> LSP. Diagnostic -> LSP. Diagnostic
112- setGhcCode mbOrigMsg diag =
113- let mbGhcCode = do
114- origMsg <- mbOrigMsg
115- code <- diagnosticCode (errMsgDiagnostic origMsg)
116- pure (InR (showGhcCode code))
117- in
118- diag { _code = mbGhcCode <|> _code diag }
111+ attachDiagnosticCode :: Maybe DiagnosticCode -> LSP. Diagnostic -> LSP. Diagnostic
112+ attachDiagnosticCode Nothing diag = diag
113+ attachDiagnosticCode (Just code) diag =
114+ let
115+ textualCode = showGhcCode code
116+ codeDesc = LSP. CodeDescription { _href = Uri $ " https://errors.haskell.org/messages/" <> textualCode }
117+ in diag { _code = Just (InR textualCode), _codeDescription = Just codeDesc}
119118
120119#if MIN_VERSION_ghc(9,9,0)
121120-- DiagnosticCode only got a show instance in 9.10.1
You can’t perform that action at this time.
0 commit comments