@@ -62,9 +62,8 @@ module Development.IDE.Core.Rules(
62
62
63
63
import Fingerprint
64
64
65
- import Data.Aeson (fromJSON , toJSON , Result (Success ), FromJSON )
65
+ import Data.Aeson (toJSON , Result (Success ))
66
66
import Data.Binary hiding (get , put )
67
- import Data.Default
68
67
import Data.Tuple.Extra
69
68
import Control.Monad.Extra
70
69
import Control.Monad.Trans.Class
@@ -136,6 +135,8 @@ import GHC.IO.Encoding
136
135
import Data.ByteString.Encoding as T
137
136
138
137
import qualified HieDb
138
+ import Ide.Plugin.Config
139
+ import qualified Data.Aeson.Types as A
139
140
140
141
-- | This is useful for rules to convert rules that can only produce errors or
141
142
-- a result into the more general IdeResult type that supports producing
@@ -1047,12 +1048,13 @@ getClientSettingsRule = defineEarlyCutOffNoFile $ \GetClientSettings -> do
1047
1048
1048
1049
-- | Returns the client configurarion stored in the IdeState.
1049
1050
-- 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
1052
1054
mbVal <- unhashed <$> useNoFile_ GetClientSettings
1053
- case fromJSON <$> mbVal of
1055
+ case A. parse (parseConfig defValue) <$> mbVal of
1054
1056
Just (Success c) -> return c
1055
- _ -> return def
1057
+ _ -> return defValue
1056
1058
1057
1059
-- | For now we always use bytecode
1058
1060
getLinkableType :: NormalizedFilePath -> Action (Maybe LinkableType )
0 commit comments