@@ -10,7 +10,6 @@ module Development.IDE.Types.Diagnostics (
10
10
ShowDiagnostic (.. ),
11
11
FileDiagnostic (.. ),
12
12
fdLspDiagnosticL ,
13
- StructuredMessage (.. ),
14
13
IdeResult ,
15
14
LSP. DiagnosticSeverity (.. ),
16
15
DiagnosticStore ,
@@ -87,10 +86,6 @@ ideErrorFromLspDiag
87
86
-> FileDiagnostic
88
87
ideErrorFromLspDiag lspDiag fdFilePath mbOrigMsg =
89
88
let fdShouldShowDiagnostic = ShowDiag
90
- fdStructuredMessage =
91
- case mbOrigMsg of
92
- Nothing -> NoStructuredMessage
93
- Just msg -> SomeStructuredMessage msg
94
89
fdLspDiagnostic =
95
90
lspDiag
96
91
& attachReason (fmap (diagnosticReason . errMsgDiagnostic) mbOrigMsg)
@@ -172,52 +167,16 @@ data ShowDiagnostic
172
167
instance NFData ShowDiagnostic where
173
168
rnf = rwhnf
174
169
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
-
203
170
-- | Human readable diagnostics for a specific file.
204
171
--
205
172
-- This type packages a pretty printed, human readable error message
206
173
-- along with the related source location so that we can display the error
207
174
-- on either the console or in the IDE at the right source location.
208
175
--
209
- -- It also optionally keeps a structured diagnostic message GhcMessage in
210
- -- StructuredMessage.
211
- --
212
176
data FileDiagnostic = FileDiagnostic
213
177
{ fdFilePath :: NormalizedFilePath
214
178
, fdShouldShowDiagnostic :: ShowDiagnostic
215
179
, 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
221
180
}
222
181
deriving (Eq , Ord , Show , Generic )
223
182
0 commit comments