File tree Expand file tree Collapse file tree 14 files changed +36
-21
lines changed
src/Language/LSP/Protocol/Message Expand file tree Collapse file tree 14 files changed +36
-21
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-types
2
2
3
- ## 2.0.0.2
3
+ ## 2.0.1.0
4
4
5
5
* Removed deprecation pragmas from fields, as these cannot currently be avoided.
6
+ * Added ` isOptionalMethod ` , that checks whether a method is optional according to the spec.
6
7
7
8
## 2.0.0.1
8
9
Original file line number Diff line number Diff line change 1
1
cabal-version : 3.0
2
2
name : lsp-types
3
- version : 2.0.0.2
3
+ version : 2.0.1.0
4
4
synopsis :
5
5
Haskell library for the Microsoft Language Server Protocol, data types
6
6
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module Language.LSP.Protocol.Message.Method where
14
14
15
15
import Data.Aeson.Types
16
16
import Data.Function (on )
17
+ import Data.List (isPrefixOf )
17
18
import Data.GADT.Compare
18
19
import Data.Proxy
19
20
import Data.Type.Equality
@@ -29,6 +30,11 @@ import Unsafe.Coerce
29
30
-- SomeMethod
30
31
---------------
31
32
33
+ -- | Is this an "optional" method which servers and clients are allowed to ignore?
34
+ isOptionalMethod :: SomeMethod -> Bool
35
+ -- See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#dollarRequests
36
+ isOptionalMethod m = " $/" `isPrefixOf` someMethodToMethodString m
37
+
32
38
deriving stock instance Show SomeMethod
33
39
instance Eq SomeMethod where
34
40
(==) = (==) `on` someMethodToMethodString
Original file line number Diff line number Diff line change 1
1
# Revision history for lsp
2
2
3
+ ## 2.1.0.0
4
+
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.
10
+
3
11
## 2.0.0.0
4
12
5
13
* Support ` lsp-types-2.0.0.0 ` .
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
}
You can’t perform that action at this time.
0 commit comments