Skip to content

Commit 9b09829

Browse files
committed
Add action to get client settings
1 parent 29ae24e commit 9b09829

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Ide/Plugin.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module Ide.Plugin
1616
, allLspCmdIds'
1717
, getPid
1818
, responseError
19+
, getClientConfig
20+
, getClientConfigAction
1921
) where
2022

2123
import Control.Exception(SomeException, catch)
@@ -36,6 +38,7 @@ import Development.IDE.Types.Diagnostics as D
3638
import Development.IDE.Types.Logger
3739
import Development.Shake hiding ( Diagnostic, command )
3840
import GHC.Generics
41+
import Ide.Logger
3942
import Ide.Plugin.Config
4043
import Ide.Plugin.Formatter
4144
import Ide.Types
@@ -592,4 +595,13 @@ getPrefixAtPos lf uri pos = do
592595
getClientConfig :: LSP.LspFuncs Config -> IO Config
593596
getClientConfig lf = fromMaybe Data.Default.def <$> LSP.config lf
594597

598+
-- | Returns the client configurarion stored in the IdeState.
599+
-- You can use this function to access it from shake Rules
600+
getClientConfigAction :: Action Config
601+
getClientConfigAction = do
602+
mbVal <- useNoFile_ GetClientSettings
603+
logm $ "getClientConfigAction:clientSettings:" ++ show mbVal
604+
case J.fromJSON <$> mbVal of
605+
Just (J.Success c) -> return c
606+
_ -> return Data.Default.def
595607
-- ---------------------------------------------------------------------

0 commit comments

Comments
 (0)