@@ -10,7 +10,6 @@ module Development.IDE.Types.Diagnostics (
1010 ShowDiagnostic (.. ),
1111 FileDiagnostic (.. ),
1212 fdLspDiagnosticL ,
13- StructuredMessage (.. ),
1413 IdeResult ,
1514 LSP. DiagnosticSeverity (.. ),
1615 DiagnosticStore ,
@@ -87,10 +86,6 @@ ideErrorFromLspDiag
8786 -> FileDiagnostic
8887ideErrorFromLspDiag lspDiag fdFilePath mbOrigMsg =
8988 let fdShouldShowDiagnostic = ShowDiag
90- fdStructuredMessage =
91- case mbOrigMsg of
92- Nothing -> NoStructuredMessage
93- Just msg -> SomeStructuredMessage msg
9489 fdLspDiagnostic =
9590 lspDiag
9691 & attachReason (fmap (diagnosticReason . errMsgDiagnostic) mbOrigMsg)
@@ -172,52 +167,16 @@ data ShowDiagnostic
172167instance NFData ShowDiagnostic where
173168 rnf = rwhnf
174169
175- -- | A Maybe-like wrapper for a GhcMessage that doesn't try to compare, show, or
176- -- force the GhcMessage inside, so that we can derive Show, Eq, Ord, NFData on
177- -- FileDiagnostic. FileDiagnostic only uses this as metadata so we can safely
178- -- ignore it in fields.
179- data StructuredMessage
180- = NoStructuredMessage
181- | SomeStructuredMessage (MsgEnvelope GhcMessage )
182- deriving (Generic )
183-
184- instance Show StructuredMessage where
185- show NoStructuredMessage = " NoStructuredMessage"
186- show SomeStructuredMessage {} = " SomeStructuredMessage"
187-
188- instance Eq StructuredMessage where
189- (==) NoStructuredMessage NoStructuredMessage = True
190- (==) SomeStructuredMessage {} SomeStructuredMessage {} = True
191- (==) _ _ = False
192-
193- instance Ord StructuredMessage where
194- compare NoStructuredMessage NoStructuredMessage = EQ
195- compare SomeStructuredMessage {} SomeStructuredMessage {} = EQ
196- compare NoStructuredMessage SomeStructuredMessage {} = GT
197- compare SomeStructuredMessage {} NoStructuredMessage = LT
198-
199- instance NFData StructuredMessage where
200- rnf NoStructuredMessage = ()
201- rnf SomeStructuredMessage {} = ()
202-
203170-- | Human readable diagnostics for a specific file.
204171--
205172-- This type packages a pretty printed, human readable error message
206173-- along with the related source location so that we can display the error
207174-- on either the console or in the IDE at the right source location.
208175--
209- -- It also optionally keeps a structured diagnostic message GhcMessage in
210- -- StructuredMessage.
211- --
212176data FileDiagnostic = FileDiagnostic
213177 { fdFilePath :: NormalizedFilePath
214178 , fdShouldShowDiagnostic :: ShowDiagnostic
215179 , fdLspDiagnostic :: Diagnostic
216- -- | The optional GhcMessage inside of this StructuredMessage is ignored for
217- -- Eq, Ord, Show, and NFData instances. This is fine because this field
218- -- should only ever be metadata and should never be used to distinguish
219- -- between FileDiagnostics.
220- , fdStructuredMessage :: StructuredMessage
221180 }
222181 deriving (Eq , Ord , Show , Generic )
223182
0 commit comments