@@ -218,6 +218,11 @@ getParsedModuleRule =
218
218
mainParse = getParsedModuleDefinition hsc opt file ms
219
219
reset_ms pm = pm { pm_mod_summary = ms' }
220
220
221
+ #if MIN_VERSION_ghc(9,0,1)
222
+ -- We no longer need to parse again if GHC version is above 9.0
223
+ -- https://github.com/haskell/haskell-language-server/issues/1892
224
+ res@ (_,pmod) <- liftIO $ (fmap . fmap . fmap ) reset_ms mainParse
225
+ #else
221
226
-- Parse again (if necessary) to capture Haddock parse errors
222
227
res@ (_,pmod) <- if gopt Opt_Haddock dflags
223
228
then
@@ -245,6 +250,7 @@ getParsedModuleRule =
245
250
-- This seems to be the correct behaviour because the Haddock flag is added
246
251
-- by us and not the user, so our IDE shouldn't stop working because of it.
247
252
_ -> pure (diagsM, res)
253
+ #endif
248
254
-- Add dependencies on included files
249
255
_ <- uses GetModificationTime $ map toNormalizedFilePath' (maybe [] pm_extra_src_files pmod)
250
256
pure res
@@ -892,12 +898,17 @@ regenerateHiFile sess f ms compNeeded = do
892
898
893
899
-- Embed haddocks in the interface file
894
900
(diags, mb_pm) <- liftIO $ getParsedModuleDefinition hsc opt f (withOptHaddock ms)
901
+ #if MIN_VERSION_ghc(9,0,1)
902
+ -- We no longer need to parse again if GHC version is above 9.0
903
+ -- https://github.com/haskell/haskell-language-server/issues/1892
904
+ #else
895
905
(diags, mb_pm) <- case mb_pm of
896
906
Just _ -> return (diags, mb_pm)
897
907
Nothing -> do
898
908
-- if parsing fails, try parsing again with Haddock turned off
899
909
(diagsNoHaddock, mb_pm) <- liftIO $ getParsedModuleDefinition hsc opt f ms
900
910
return (mergeParseErrorsHaddock diagsNoHaddock diags, mb_pm)
911
+ #endif
901
912
case mb_pm of
902
913
Nothing -> return (diags, Nothing )
903
914
Just pm -> do
0 commit comments