File tree Expand file tree Collapse file tree 11 files changed +22
-15
lines changed Expand file tree Collapse file tree 11 files changed +22
-15
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ main :: IO Int
7070main = runServer $ ServerDefinition
7171 { onConfigurationChange = const $ pure $ Right ()
7272 , doInitialize = \ env _req -> pure $ Right env
73- , staticHandlers = handlers
73+ , staticHandlers = \ _caps -> handlers
7474 , interpretHandler = \ env -> Iso (runLspT env) liftIO
7575 , options = defaultOptions
7676 }
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ server = ServerDefinition
3535 { onConfigurationChange = const $ const $ Right ()
3636 , defaultConfig = ()
3737 , doInitialize = \ env _req -> pure $ Right env
38- , staticHandlers = handlers
38+ , staticHandlers = \ _caps -> handlers
3939 , interpretHandler = \ env -> Iso (runLspT env) liftIO
4040 , options = defaultOptions
4141 }
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ main = hspec $ do
3535 { onConfigurationChange = const $ const $ Right ()
3636 , defaultConfig = ()
3737 , doInitialize = \ env _req -> pure $ Right env
38- , staticHandlers = handlers killVar
38+ , staticHandlers = \ _caps -> handlers killVar
3939 , interpretHandler = \ env -> Iso (runLspT env) liftIO
4040 , options = defaultOptions
4141 }
@@ -82,7 +82,7 @@ main = hspec $ do
8282 { onConfigurationChange = const $ const $ Right ()
8383 , defaultConfig = ()
8484 , doInitialize = \ env _req -> pure $ Right env
85- , staticHandlers = handlers
85+ , staticHandlers = \ _caps -> handlers
8686 , interpretHandler = \ env -> Iso (runLspT env) liftIO
8787 , options = defaultOptions
8888 }
Original file line number Diff line number Diff line change 11cabal-version : 2.4
22name : lsp-test
3- version : 0.15.0.0
3+ version : 0.15.0.1
44synopsis : Functional test framework for LSP servers.
55description :
66 A test framework for writing tests against
@@ -59,7 +59,7 @@ library
5959 , filepath
6060 , Glob >= 0.9 && < 0.11
6161 , lens
62- , lsp ^>= 2.0
62+ , lsp ^>= 2.1
6363 , lsp-types ^>= 2.0
6464 , mtl < 2.4
6565 , parser-combinators >= 1.2
@@ -102,7 +102,7 @@ test-suite tests
102102 , filepath
103103 , hspec
104104 , lens
105- , lsp ^>= 2.0
105+ , lsp ^>= 2.1
106106 , lsp-test
107107 , mtl < 2.4
108108 , parser-combinators
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ withDummyServer f = do
3131 { doInitialize = \ env _req -> pure $ Right env
3232 , defaultConfig = ()
3333 , onConfigurationChange = const $ pure $ Right ()
34- , staticHandlers = handlers
34+ , staticHandlers = \ _caps -> handlers
3535 , interpretHandler = \ env ->
3636 Iso (\ m -> runLspT env (runReaderT m handlerEnv)) liftIO
3737 , options = defaultOptions {optExecuteCommandCommands = Just [" doAnEdit" ]}
Original file line number Diff line number Diff line change 11# Revision history for lsp
22
3- ## 2.0 .0.1
3+ ## 2.1 .0.0
44
55* Fix handling of optional methods.
6+ * ` staticHandlers ` now takes the client capabilities as an argument.
7+ These are static across the lifecycle of the server, so this allows
8+ a server to decide at construction e.g. whether to provide handlers
9+ for resolve methods depending on whether the client supports it.
610
711## 2.0.0.0
812
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ run = flip E.catches handlers $ do
9696 J. Success cfg -> Right cfg
9797 , doInitialize = \ env _ -> forkIO (reactor stderrLogger rin) >> pure (Right env)
9898 -- Handlers log to both the client and stderr
99- , staticHandlers = lspHandlers dualLogger rin
99+ , staticHandlers = \ _caps -> lspHandlers dualLogger rin
100100 , interpretHandler = \ env -> Iso (runLspT env) liftIO
101101 , options = lspOptions
102102 }
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ main = runServer $ ServerDefinition
4141 { onConfigurationChange = const $ const $ Right ()
4242 , defaultConfig = ()
4343 , doInitialize = \ env _req -> pure $ Right env
44- , staticHandlers = handlers
44+ , staticHandlers = \ _caps -> handlers
4545 , interpretHandler = \ env -> Iso (runLspT env) liftIO
4646 , options = defaultOptions
4747 }
Original file line number Diff line number Diff line change 11cabal-version : 2.2
22name : lsp
3- version : 2.0 .0.1
3+ version : 2.1 .0.0
44synopsis : Haskell library for the Microsoft Language Server Protocol
55description :
66 An implementation of the types, and basic message server to
Original file line number Diff line number Diff line change @@ -294,10 +294,12 @@ data ServerDefinition config = forall m a.
294294 -- language server implementation the chance to create any processes or
295295 -- start new threads that may be necessary for the server lifecycle. It can
296296 -- also return an error in the initialization if necessary.
297- , staticHandlers :: Handlers m
297+ , staticHandlers :: ClientCapabilities -> Handlers m
298298 -- ^ Handlers for any methods you want to statically support.
299299 -- The handlers here cannot be unregistered during the server's lifetime
300300 -- and will be registered statically in the initialize request.
301+ -- The handlers provided can depend on the client capabilities, which
302+ -- are static across the lifetime of the server.
301303 , interpretHandler :: a -> (m <~> IO )
302304 -- ^ How to run the handlers in your own monad of choice, @m@.
303305 -- It is passed the result of 'doInitialize', so typically you will want
You can’t perform that action at this time.
0 commit comments