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
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-types
22
3- ## 2.0.0.2
3+ ## 2.0.1.0
44
55* 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.
67
78## 2.0.0.1
89
Original file line number Diff line number Diff line change 11cabal-version : 3.0
22name : lsp-types
3- version : 2.0.0.2
3+ version : 2.0.1.0
44synopsis :
55 Haskell library for the Microsoft Language Server Protocol, data types
66
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ module Language.LSP.Protocol.Message.Method where
1414
1515import Data.Aeson.Types
1616import Data.Function (on )
17+ import Data.List (isPrefixOf )
1718import Data.GADT.Compare
1819import Data.Proxy
1920import Data.Type.Equality
@@ -29,6 +30,11 @@ import Unsafe.Coerce
2930-- SomeMethod
3031---------------
3132
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+
3238deriving stock instance Show SomeMethod
3339instance Eq SomeMethod where
3440 (==) = (==) `on` someMethodToMethodString
Original file line number Diff line number Diff line change 11# Revision history for lsp
22
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+
311## 2.0.0.0
412
513* 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
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 }
You can’t perform that action at this time.
0 commit comments