Skip to content
Snippets Groups Projects

Add a warning when the installed HLS and GHC versions are not compatible.

Merged Chris Smith requested to merge cdsmith/ghcup-hs:master into master
All threads resolved!
+ 27
0
@@ -868,6 +868,8 @@ setGHC ver sghc = do
-- create symlink for share dir
when (isNothing . _tvTarget $ ver) $ lift $ symlinkShareDir ghcdir verS
when (sghc == SetGHCOnly) $ lift warnAboutHlsCompatibility
pure ver
where
@@ -978,6 +980,8 @@ setHLS ver = do
lift $ createLink destL wrapper
lift warnAboutHlsCompatibility
pure ()
@@ -1010,6 +1014,29 @@ setStack ver = do
pure ()
-- | Warn if the installed and set HLS is not compatible with the installed and
-- set GHC version.
warnAboutHlsCompatibility :: ( MonadReader env m
, HasDirs env
, HasLog env
, MonadThrow m
, MonadCatch m
, MonadIO m
)
=> m ()
warnAboutHlsCompatibility = do
supportedGHC <- hlsGHCVersions
currentGHC <- fmap _tvVersion <$> ghcSet Nothing
currentHLS <- hlsSet
case (currentGHC, currentHLS) of
(Just gv, Just hv) | gv `notElem` supportedGHC -> do
logWarn $ "GHC " <> T.pack (prettyShow gv) <> " is not compatible with "
<> "Haskell Language Server " <> T.pack (prettyShow hv) <> "."
logWarn "Haskell IDE support may not work until this is fixed."
logWarn $ "Install a different HLS version, or run `ghcup list` to see "
<> "supported GHC versions."
_ -> return ()
------------------
--[ List tools ]--
Loading