mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-02 08:53:07 +03:00
Send a warning when using the implicit cradle (#799)
* Send a warning when using the implicit cradle * Implicit cradle Co-authored-by: Neil Mitchell <ndmitchell@gmail.com> Co-authored-by: Neil Mitchell <ndmitchell@gmail.com>
This commit is contained in:
parent
7d9d2a5f0a
commit
b7c9d6da2d
@ -250,14 +250,18 @@ loadSession dir = do
|
||||
|
||||
let consultCradle :: Maybe FilePath -> FilePath -> IO ([NormalizedFilePath], (IdeResult HscEnvEq, [FilePath]))
|
||||
consultCradle hieYaml cfp = do
|
||||
when optTesting $ eventer $ notifyCradleLoaded cfp
|
||||
logInfo logger $ T.pack ("Consulting the cradle for " <> show cfp)
|
||||
lfp <- flip makeRelative cfp <$> getCurrentDirectory
|
||||
logInfo logger $ T.pack ("Consulting the cradle for " <> show lfp)
|
||||
|
||||
when (isNothing hieYaml) $ eventer $ notifyUserImplicitCradle lfp
|
||||
|
||||
cradle <- maybe (loadImplicitHieCradle $ addTrailingPathSeparator dir) loadCradle hieYaml
|
||||
-- Display a user friendly progress message here: They probably don't know what a
|
||||
-- cradle is
|
||||
|
||||
when optTesting $ eventer $ notifyCradleLoaded lfp
|
||||
|
||||
-- Display a user friendly progress message here: They probably don't know what a cradle is
|
||||
let progMsg = "Setting up " <> T.pack (takeBaseName (cradleRootDir cradle))
|
||||
<> " (for " <> T.pack cfp <> ")"
|
||||
<> " (for " <> T.pack lfp <> ")"
|
||||
eopts <- withIndefiniteProgress progMsg NotCancellable $
|
||||
cradleToOptsAndLibDir cradle cfp
|
||||
|
||||
@ -670,6 +674,14 @@ getCacheDir prefix opts = getXdgDirectory XdgCache (cacheDir </> prefix ++ "-" +
|
||||
cacheDir :: String
|
||||
cacheDir = "ghcide"
|
||||
|
||||
notifyUserImplicitCradle:: FilePath -> FromServerMessage
|
||||
notifyUserImplicitCradle fp =
|
||||
NotShowMessage $
|
||||
NotificationMessage "2.0" WindowShowMessage $ ShowMessageParams MtWarning $
|
||||
"No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for "
|
||||
<> T.pack fp <>
|
||||
".\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie)"
|
||||
|
||||
notifyCradleLoaded :: FilePath -> FromServerMessage
|
||||
notifyCradleLoaded fp =
|
||||
NotCustomServer $
|
||||
|
Loading…
Reference in New Issue
Block a user