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
70
70
main = runServer $ ServerDefinition
71
71
{ onConfigurationChange = const $ pure $ Right ()
72
72
, doInitialize = \ env _req -> pure $ Right env
73
- , staticHandlers = handlers
73
+ , staticHandlers = \ _caps -> handlers
74
74
, interpretHandler = \ env -> Iso (runLspT env) liftIO
75
75
, options = defaultOptions
76
76
}
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ server = ServerDefinition
35
35
{ onConfigurationChange = const $ const $ Right ()
36
36
, defaultConfig = ()
37
37
, doInitialize = \ env _req -> pure $ Right env
38
- , staticHandlers = handlers
38
+ , staticHandlers = \ _caps -> handlers
39
39
, interpretHandler = \ env -> Iso (runLspT env) liftIO
40
40
, options = defaultOptions
41
41
}
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ main = hspec $ do
35
35
{ onConfigurationChange = const $ const $ Right ()
36
36
, defaultConfig = ()
37
37
, doInitialize = \ env _req -> pure $ Right env
38
- , staticHandlers = handlers killVar
38
+ , staticHandlers = \ _caps -> handlers killVar
39
39
, interpretHandler = \ env -> Iso (runLspT env) liftIO
40
40
, options = defaultOptions
41
41
}
@@ -82,7 +82,7 @@ main = hspec $ do
82
82
{ onConfigurationChange = const $ const $ Right ()
83
83
, defaultConfig = ()
84
84
, doInitialize = \ env _req -> pure $ Right env
85
- , staticHandlers = handlers
85
+ , staticHandlers = \ _caps -> handlers
86
86
, interpretHandler = \ env -> Iso (runLspT env) liftIO
87
87
, options = defaultOptions
88
88
}
Original file line number Diff line number Diff line change 1
1
cabal-version : 2.4
2
2
name : lsp-test
3
- version : 0.15.0.0
3
+ version : 0.15.0.1
4
4
synopsis : Functional test framework for LSP servers.
5
5
description :
6
6
A test framework for writing tests against
@@ -59,7 +59,7 @@ library
59
59
, filepath
60
60
, Glob >= 0.9 && < 0.11
61
61
, lens
62
- , lsp ^>= 2.0
62
+ , lsp ^>= 2.1
63
63
, lsp-types ^>= 2.0
64
64
, mtl < 2.4
65
65
, parser-combinators >= 1.2
@@ -102,7 +102,7 @@ test-suite tests
102
102
, filepath
103
103
, hspec
104
104
, lens
105
- , lsp ^>= 2.0
105
+ , lsp ^>= 2.1
106
106
, lsp-test
107
107
, mtl < 2.4
108
108
, parser-combinators
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ withDummyServer f = do
31
31
{ doInitialize = \ env _req -> pure $ Right env
32
32
, defaultConfig = ()
33
33
, onConfigurationChange = const $ pure $ Right ()
34
- , staticHandlers = handlers
34
+ , staticHandlers = \ _caps -> handlers
35
35
, interpretHandler = \ env ->
36
36
Iso (\ m -> runLspT env (runReaderT m handlerEnv)) liftIO
37
37
, options = defaultOptions {optExecuteCommandCommands = Just [" doAnEdit" ]}
Original file line number Diff line number Diff line change 1
1
# Revision history for lsp
2
2
3
- ## 2.0 .0.1
3
+ ## 2.1 .0.0
4
4
5
5
* 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.
6
10
7
11
## 2.0.0.0
8
12
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ run = flip E.catches handlers $ do
96
96
J. Success cfg -> Right cfg
97
97
, doInitialize = \ env _ -> forkIO (reactor stderrLogger rin) >> pure (Right env)
98
98
-- Handlers log to both the client and stderr
99
- , staticHandlers = lspHandlers dualLogger rin
99
+ , staticHandlers = \ _caps -> lspHandlers dualLogger rin
100
100
, interpretHandler = \ env -> Iso (runLspT env) liftIO
101
101
, options = lspOptions
102
102
}
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ main = runServer $ ServerDefinition
41
41
{ onConfigurationChange = const $ const $ Right ()
42
42
, defaultConfig = ()
43
43
, doInitialize = \ env _req -> pure $ Right env
44
- , staticHandlers = handlers
44
+ , staticHandlers = \ _caps -> handlers
45
45
, interpretHandler = \ env -> Iso (runLspT env) liftIO
46
46
, options = defaultOptions
47
47
}
Original file line number Diff line number Diff line change 1
1
cabal-version : 2.2
2
2
name : lsp
3
- version : 2.0 .0.1
3
+ version : 2.1 .0.0
4
4
synopsis : Haskell library for the Microsoft Language Server Protocol
5
5
description :
6
6
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.
294
294
-- language server implementation the chance to create any processes or
295
295
-- start new threads that may be necessary for the server lifecycle. It can
296
296
-- also return an error in the initialization if necessary.
297
- , staticHandlers :: Handlers m
297
+ , staticHandlers :: ClientCapabilities -> Handlers m
298
298
-- ^ Handlers for any methods you want to statically support.
299
299
-- The handlers here cannot be unregistered during the server's lifetime
300
300
-- 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.
301
303
, interpretHandler :: a -> (m <~> IO )
302
304
-- ^ How to run the handlers in your own monad of choice, @m@.
303
305
-- It is passed the result of 'doInitialize', so typically you will want
You can’t perform that action at this time.
0 commit comments