Skip to content

Commit 1bc221c

Browse files
author
Jaro Reinders
committed
Revert "Set CodeDescription from HaskellErrorIndex when available"
This reverts commit 14d6697.
1 parent 1f835da commit 1bc221c

File tree

4 files changed

+7
-129
lines changed

4 files changed

+7
-129
lines changed

ghcide/ghcide.cabal

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ library
8383
, hiedb ^>= 0.6.0.0
8484
, hls-graph == 2.9.0.1
8585
, hls-plugin-api == 2.9.0.1
86-
, http-conduit
8786
, implicit-hie >= 0.1.4.0 && < 0.1.5
8887
, lens
8988
, lens-aeson
@@ -136,7 +135,6 @@ library
136135
Development.IDE.Core.Debouncer
137136
Development.IDE.Core.FileStore
138137
Development.IDE.Core.FileUtils
139-
Development.IDE.Core.HaskellErrorIndex
140138
Development.IDE.Core.IdeConfiguration
141139
Development.IDE.Core.OfInterest
142140
Development.IDE.Core.PluginUtils

ghcide/src/Development/IDE/Core/HaskellErrorIndex.hs

Lines changed: 0 additions & 104 deletions
This file was deleted.

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ import Control.Concurrent.STM.Stats (atomicallyNamed)
8383
import Control.Concurrent.Strict
8484
import Control.DeepSeq
8585
import Control.Exception.Extra hiding (bracket_)
86-
import Control.Lens (over, (%~), (&), (?~))
86+
import Control.Lens ((&), (?~), (%~))
8787
import Control.Monad.Extra
8888
import Control.Monad.IO.Class
8989
import Control.Monad.Reader
@@ -121,8 +121,6 @@ import Data.Vector (Vector)
121121
import qualified Data.Vector as Vector
122122
import Development.IDE.Core.Debouncer
123123
import Development.IDE.Core.FileUtils (getModTime)
124-
import Development.IDE.Core.HaskellErrorIndex hiding (Log)
125-
import qualified Development.IDE.Core.HaskellErrorIndex as HaskellErrorIndex
126124
import Development.IDE.Core.PositionMapping
127125
import Development.IDE.Core.ProgressReporting
128126
import Development.IDE.Core.RuleTypes
@@ -198,7 +196,6 @@ data Log
198196
| LogShakeGarbageCollection !T.Text !Int !Seconds
199197
-- * OfInterest Log messages
200198
| LogSetFilesOfInterest ![(NormalizedFilePath, FileOfInterestStatus)]
201-
| LogInitializeHaskellErrorIndex !HaskellErrorIndex.Log
202199
deriving Show
203200

204201
instance Pretty Log where
@@ -242,8 +239,6 @@ instance Pretty Log where
242239
LogSetFilesOfInterest ofInterest ->
243240
"Set files of interst to" <> Pretty.line
244241
<> indent 4 (pretty $ fmap (first fromNormalizedFilePath) ofInterest)
245-
LogInitializeHaskellErrorIndex hei ->
246-
"Haskell Error Index:" <+> pretty hei
247242

248243
-- | We need to serialize writes to the database, so we send any function that
249244
-- needs to write to the database over the channel, where it will be picked up by
@@ -339,8 +334,6 @@ data ShakeExtras = ShakeExtras
339334
-- ^ Queue of restart actions to be run.
340335
, loaderQueue :: TQueue (IO ())
341336
-- ^ Queue of loader actions to be run.
342-
, haskellErrorIndex :: Maybe HaskellErrorIndex
343-
-- ^ List of errors in the Haskell Error Index (errors.haskell.org)
344337
}
345338

346339
type WithProgressFunc = forall a.
@@ -711,7 +704,6 @@ shakeOpen recorder lspEnv defaultConfig idePlugins debouncer
711704
dirtyKeys <- newTVarIO mempty
712705
-- Take one VFS snapshot at the start
713706
vfsVar <- newTVarIO =<< vfsSnapshot lspEnv
714-
haskellErrorIndex <- initHaskellErrorIndex (cmapWithPrio LogInitializeHaskellErrorIndex recorder)
715707
pure ShakeExtras{shakeRecorder = recorder, ..}
716708
shakeDb <-
717709
shakeNewDatabase
@@ -1332,25 +1324,24 @@ traceA (A Failed{}) = "Failed"
13321324
traceA (A Stale{}) = "Stale"
13331325
traceA (A Succeeded{}) = "Success"
13341326

1335-
updateFileDiagnostics
1336-
:: Recorder (WithPriority Log)
1327+
updateFileDiagnostics :: MonadIO m
1328+
=> Recorder (WithPriority Log)
13371329
-> NormalizedFilePath
13381330
-> Maybe Int32
13391331
-> Key
13401332
-> ShakeExtras
13411333
-> [FileDiagnostic] -- ^ current results
1342-
-> Action ()
1334+
-> m ()
13431335
updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnostics, publishedDiagnostics, debouncer, lspEnv, ideTesting} current0 = do
1344-
hei <- haskellErrorIndex <$> getShakeExtras
13451336
liftIO $ withTrace ("update diagnostics " <> fromString(fromNormalizedFilePath fp)) $ \ addTag -> do
13461337
addTag "key" (show k)
1347-
current <- traverse (attachHEI hei) $ map (over fdLspDiagnosticL diagsFromRule) current0
13481338
let (currentShown, currentHidden) = partition ((== ShowDiag) . fdShouldShowDiagnostic) current
13491339
uri = filePathToUri' fp
13501340
addTagUnsafe :: String -> String -> String -> a -> a
13511341
addTagUnsafe msg t x v = unsafePerformIO(addTag (msg <> t) x) `seq` v
13521342
update :: (forall a. String -> String -> a -> a) -> [FileDiagnostic] -> STMDiagnosticStore -> STM [FileDiagnostic]
13531343
update addTagUnsafeMethod new store = addTagUnsafeMethod "count" (show $ Prelude.length new) $ setStageDiagnostics addTagUnsafeMethod uri ver (renderKey k) new store
1344+
current = map (fdLspDiagnosticL %~ diagsFromRule) current0
13541345
addTag "version" (show ver)
13551346
mask_ $ do
13561347
-- Mask async exceptions to ensure that updated diagnostics are always
@@ -1374,15 +1365,6 @@ updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnosti
13741365
LSP.PublishDiagnosticsParams (fromNormalizedUri uri') (fmap fromIntegral ver) (map fdLspDiagnostic newDiags)
13751366
return action
13761367
where
1377-
attachHEI :: Maybe HaskellErrorIndex -> FileDiagnostic -> IO FileDiagnostic
1378-
attachHEI mbHei diag
1379-
| Just hei <- mbHei
1380-
, SomeStructuredMessage msg <- fdStructuredMessage diag
1381-
, Just heiError <- hei `heiGetError` errMsgDiagnostic msg
1382-
= pure $ diag & fdLspDiagnosticL %~ attachHeiErrorCodeDescription heiError
1383-
| otherwise
1384-
= pure diag
1385-
13861368
diagsFromRule :: Diagnostic -> Diagnostic
13871369
diagsFromRule c@Diagnostic{_range}
13881370
| coerce ideTesting = c & L.relatedInformation ?~

ghcide/src/Development/IDE/Types/Diagnostics.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ showGhcCode = T.pack . show
119119
showGhcCode :: DiagnosticCode -> T.Text
120120
showGhcCode (DiagnosticCode prefix c) = T.pack $ prefix ++ "-" ++ printf "%05d" c
121121
#endif
122+
in
123+
FileDiagnostic {..}
122124

123125
attachedReason :: Traversal' Diagnostic (Maybe JSON.Value)
124126
attachedReason = data_ . non (JSON.object []) . JSON.atKey "attachedReason"

0 commit comments

Comments
 (0)