File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
ghcide/src/Development/IDE/Types Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -102,20 +102,19 @@ ideErrorFromLspDiag lspDiag fdFilePath mbOrigMsg =
102
102
fdLspDiagnostic =
103
103
lspDiag
104
104
& attachReason (fmap (diagnosticReason . errMsgDiagnostic) mbOrigMsg)
105
- & setGhcCode mbOrigMsg
105
+ & attachDiagnosticCode ((diagnosticCode . errMsgDiagnostic) =<< mbOrigMsg)
106
106
in
107
107
FileDiagnostic {.. }
108
108
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
110
110
-- 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}
119
118
120
119
#if MIN_VERSION_ghc(9,9,0)
121
120
-- DiagnosticCode only got a show instance in 9.10.1
You can’t perform that action at this time.
0 commit comments