Skip to content

Commit 796a247

Browse files
committed
Add setConfig as an analogue to getConfig (#414)
1 parent 81a9931 commit 796a247

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lsp/src/Language/LSP/Server.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module Language.LSP.Server
2626

2727
, getClientCapabilities
2828
, getConfig
29+
, setConfig
2930
, getRootPath
3031
, getWorkspaceFolders
3132

lsp/src/Language/LSP/Server/Core.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,18 @@ freshLspId = do
441441
-- ---------------------------------------------------------------------
442442

443443
-- | The current configuration from the client as set via the @initialize@ and
444-
-- @workspace/didChangeConfiguration@ requests.
444+
-- @workspace/didChangeConfiguration@ requests, as well as by calls to
445+
-- 'setConfig'.
445446
getConfig :: MonadLsp config m => m config
446447
getConfig = getsState resConfig
447448

448449
{-# INLINE getConfig #-}
449450

451+
setConfig :: MonadLsp config m => config -> m ()
452+
setConfig config = stateState resConfig (const ((), config))
453+
454+
{-# INLINE setConfig #-}
455+
450456
getClientCapabilities :: MonadLsp config m => m J.ClientCapabilities
451457
getClientCapabilities = resClientCapabilities <$> getLspEnv
452458

0 commit comments

Comments
 (0)