Skip to content

Commit

Permalink
Session.initialize takes initialization options
Browse files Browse the repository at this point in the history
  • Loading branch information
ners committed Jul 14, 2024
1 parent 284bb11 commit 17047cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Revision history for lsp-client

## 0.3.1.0 -- 2024-06-24
## 0.4.0.0 -- 2024-06-24

* Introduce SessionT and MonadSession
* Lift all functions to MonadSession
* Session.initialize now takes LSP initialization options
* Add Session.getAllVersionedDocs

## 0.3.0.0 -- 2024-04-04
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lsp-client.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: lsp-client
version: 0.3.1.0
version: 0.4.0.0
synopsis: Haskell library for Language Server Protocol clients
homepage: https://github.com/ners/lsp-client/blob/master/README.md
license: Apache-2.0
Expand Down
7 changes: 4 additions & 3 deletions src/Language/LSP/Client/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Control.Monad.IO.Class (MonadIO (liftIO))
import Control.Monad.Reader (ReaderT (runReaderT), ask, asks)
import Control.Monad.State (StateT, execState)
import Control.Monad.Trans.Class (MonadTrans, lift)
import Data.Aeson (Value)
import Data.Default (def)
import Data.Foldable (foldl', foldr', forM_, toList)
import Data.Function (on)
Expand Down Expand Up @@ -361,8 +362,8 @@ lspClientInfo = #name .== "lsp-client" .+ #version .== Just CURRENT_PACKAGE_VERS
{- | Performs the initialisation handshake and synchronously waits for its completion.
When the function completes, the session is initialised.
-}
initialize :: (MonadSession m) => m ()
initialize = liftSession $ do
initialize :: (MonadSession m) => Maybe Value -> m ()
initialize options = liftSession $ do
pid <- liftIO getProcessID
response <-
request
Expand All @@ -374,7 +375,7 @@ initialize = liftSession $ do
, _locale = Nothing
, _rootPath = Nothing
, _rootUri = InR Null
, _initializationOptions = Nothing
, _initializationOptions = options
, _capabilities = fullCaps
, _trace = Just TraceValues_Off
, _workspaceFolders = Nothing
Expand Down

0 comments on commit 17047cc

Please sign in to comment.