Merge remote-tracking branch 'origin/merge-requests/172'

This commit is contained in:
Julian Ospald 2021-09-14 12:26:41 +02:00
commit c163278c64
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
1 changed files with 27 additions and 0 deletions

View File

@ -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 ]--