@@ -62,9 +62,8 @@ module Development.IDE.Core.Rules(
6262
6363import Fingerprint
6464
65- import Data.Aeson (fromJSON , toJSON , Result (Success ), FromJSON )
65+ import Data.Aeson (toJSON , Result (Success ))
6666import Data.Binary hiding (get , put )
67- import Data.Default
6867import Data.Tuple.Extra
6968import Control.Monad.Extra
7069import Control.Monad.Trans.Class
@@ -136,6 +135,8 @@ import GHC.IO.Encoding
136135import Data.ByteString.Encoding as T
137136
138137import qualified HieDb
138+ import Ide.Plugin.Config
139+ import qualified Data.Aeson.Types as A
139140
140141-- | This is useful for rules to convert rules that can only produce errors or
141142-- a result into the more general IdeResult type that supports producing
@@ -1047,12 +1048,13 @@ getClientSettingsRule = defineEarlyCutOffNoFile $ \GetClientSettings -> do
10471048
10481049-- | Returns the client configurarion stored in the IdeState.
10491050-- You can use this function to access it from shake Rules
1050- getClientConfigAction :: (Default a , FromJSON a ) => Action a
1051- getClientConfigAction = do
1051+ getClientConfigAction :: Config -- ^ default value
1052+ -> Action Config
1053+ getClientConfigAction defValue = do
10521054 mbVal <- unhashed <$> useNoFile_ GetClientSettings
1053- case fromJSON <$> mbVal of
1055+ case A. parse (parseConfig defValue) <$> mbVal of
10541056 Just (Success c) -> return c
1055- _ -> return def
1057+ _ -> return defValue
10561058
10571059-- | For now we always use bytecode
10581060getLinkableType :: NormalizedFilePath -> Action (Maybe LinkableType )
0 commit comments